json
JSON parsing and serialization.
Import
import jsonFunctions
json.parse(str: str) -> any
Parse a JSON string into an XS value. Raises JsonError on invalid input.
json.parse_safe(str: str) -> any
Same as parse but returns null instead of raising on invalid input.
json.stringify(val: any) -> str
Serialize an XS value to a compact JSON string.
json.pretty(val: any) -> str
Serialize to JSON with indentation for readability.
json.valid(str: str) -> bool
Check if a string is valid JSON without parsing it.
Examples
scratch.xs