Skip to main content

JSON

It's worth mentioning that JSON serialization and parsing is fully supported in DeviceScript.

You can use the JSON object to parse and stringify JSON objects, just like in JavaScript.

JSON.parse

const msg = JSON.parse('{"hello": "world"}')
// destructure field 'hello'
const { hello } = msg

JSON.stringify

const json = JSON.stringify({ hello: "world" })