Skip to content

Instantly share code, notes, and snippets.

@mandrasch
Last active March 6, 2023 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandrasch/260f620c3b0d8003aec2d3ec18c44ea6 to your computer and use it in GitHub Desktop.
Save mandrasch/260f620c3b0d8003aec2d3ec18c44ea6 to your computer and use it in GitHub Desktop.
JSON.stringify with nested objects
var o1 = [{
"name":"string",
"active":"bool",
"data":[{
"value":"number",
"date":"string"
},{
"value":"number2",
"date":"string2",
"children":[
{"test":"123"},
{"test":"456"}
]
}]
}];
JSON.stringify(o1);
// output:
// '[{"name":"string","active":"bool","data":[{"value":"number","date":"string"},{"value":"number2","date":"string2","children":[{"test":"123"},{"test":"456"}]}]}]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment