JSON.stringify()

JSON.stringify(value) → string

Serialises a value to JSON text — equivalent to the global string() for objects.

Available per the mJS standard. In the factory examples the global string() function is normally used for the same purpose.

Arguments

NameTypeRequiredDefaultDescription
value any yes The value to serialise.

Returns

string JSON text.

Example

let payload = JSON.stringify({ v: 14.3 }); // '{"v":14.3}'