JSON
var json = {a:1,b:2}; var data = JSON.stringify(json); // '{"a":1,"b":2}'
JSON5
var json = {a:1,b:2}; var data = JSON5.stringify(s); // "'{a:1,b:2}'"
Possible workaround to convert standard JSON to JSON5 for .stringify()
var json = {a:1,b:2}; var data = JSON.stringify(json).replace(/\"/g, ''); // '{a:1,b:2}'
But how to convert a JSON5 data string back to a json object in Espruino?
@MaBe started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
JSON
JSON5
Possible workaround to convert standard JSON to JSON5 for .stringify()
But how to convert a JSON5 data string back to a json object in Espruino?