Diysb Tools

Stringify JSON

Convert JavaScript objects to JSON string format. Serialize data structures into JSON strings for storage or transmission.

JSON Tools
JavaScript Object/Array Input
JSON String Output
Tool options
Indentation Settings
Use Spaces
Indent output with spaces
Use Tabs
Indent output with tabs
Options
Convert HTML special characters to their entity references
Stringify JSON Examples

Simple Object to JSON

Convert a basic JavaScript object into a JSON string.

{ name: "John", age: 30 }
{ name: "John", age: 30 }
{ "name": "John", "age": 30 }
{ "name": "John", "age": 30 }
Indentation Settings
Use Spaces
Indent output with spaces
Use Tabs
Indent output with tabs
Options
Convert HTML special characters to their entity references

Array with Mixed Types

Convert an array containing different types of values into JSON.

[1, "hello", true, null, { x: 10 }]
[1, "hello", true, null, { x: 10 }]
[ 1, "hello", true, null, { "x": 10 } ]
[ 1, "hello", true, null, { "x": 10 } ]
Indentation Settings
Use Spaces
Indent output with spaces
Use Tabs
Indent output with tabs
Options
Convert HTML special characters to their entity references

HTML-Escaped JSON

Convert an object to JSON with HTML characters escaped.

{ html: "<div>Hello & Welcome</div>", message: "Special chars: > & ' \"" }
{ html: "<div>Hello & Welcome</div>", message: "Special chars: > & ' \"" }
{ &quot;html&quot;: &quot;&lt;div&gt;Hello &amp; Welcome&lt;/div&gt;&quot;, &quot;message&quot;: &quot;Special chars: &lt; &gt; &amp; &#039; &quot;&quot; }
{ &quot;html&quot;: &quot;&lt;div&gt;Hello &amp; Welcome&lt;/div&gt;&quot;, &quot;message&quot;: &quot;Special chars: &lt; &gt; &amp; &#039; &quot;&quot; }
Indentation Settings
Use Spaces
Indent output with spaces
Use Tabs
Indent output with tabs
Options
Convert HTML special characters to their entity references