Skip to main content

script_value_to_json

Function script_value_to_json 

Source
pub fn script_value_to_json(value: &ScriptValue) -> String
Expand description

Write value as JSON text: the reverse of parse_json.

A map becomes an object with its keys in sorted order, so the same value always writes the same text; an array an array; a scalar keeps its type; ScriptValue::Unit is null. JSON has no spelling for a float that is not finite, so one is written as null too. An integer past 2^53 is written exactly, and a JavaScript reader rounds it.