> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/val/obj/convert/serializing-objects.md).

# serializing objects

[JS](/web/js.md) ⟩ [value](/web/js/val.md) ⟩ [object](/web/js/val/obj.md) ⟩ serialize

{% hint style="success" %} <mark style="color:red;">**convert**</mark>**/**<mark style="color:green;">**restore**</mark> an [**object**](/web/js/val/obj.md)'s <mark style="color:yellow;">**state**</mark> <mark style="color:red;">**to**</mark>/<mark style="color:green;">**from**</mark> a <mark style="color:yellow;">**string**</mark>.

```javascript
JSON.stringify(value, [replacer], [space])    // value -> string
JSON.parse(text, [reviver])                   // string -> value
```

{% endhint %}

{% tabs %}
{% tab title="👥 相關" %}

* [converting objects](/web/js/val/obj/convert.md)
  {% endtab %}

{% tab title="📗 參考" %}

* [ ] [JavaScript: The Definitive Guide](/web/master/ref/javascript-the-definitive-guide.md) ⟩&#x20;
  * [ ] 6.8 Serializing Objects
  * [ ] 11.6 JSON Serialization & Parsing
    {% endtab %}

{% tab title="📘 手冊" %}

* [JSON.stringify()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
* [JSON.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
  {% endtab %}
  {% endtabs %}
