JSON - Kirix Documentation

Developer Resources

JSON

Overview

The JSON object provides a convenient way to parse JSON and serialize objects into JSON.

Methods

JSON.parse
Parses a JSON string into an object
JSON.stringify
Encodes an object into a JSON string.

JSON.parse

function Json.parse(string : String) : Object

Arguments

text
The string to decode.

Returns

Returns an object from the parsed string.

Description

Parses a JSON string into an object.

JSON.stringify

function JSON.stringify(object : Object, replacer : Function, space : Number, String) : String

Arguments

object
The object to encode.
replacer
An optional function to use when generating the return string.
space
An optional number or string space parameter.

Returns

Returns a string representing the encoded object.

Description

Encodes the object into a JSON string. If a replacer function is specified, the replacer function's return value will be used for the values in the return string. If a space parameter is specified, the return string will include formatting spaces.