Table of Contents

Table of Contents

FlexScript Class - JSON

JSON

Description

A class containing common JSON functions.

Static Methods

parse Parses a JSON string and returns a Variant.
stringify Converts a Variant into a JSON string.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

JSON.parse()

static Variant parse( string json )

Parameters

json The JSON string.

Returns

Variant The parsed JSON as a Variant.

Description

Parses a JSON string and returns a Variant.


Array array = JSON.parse("[0, \"string\"]");
Map map = JSON.parse("{\"number\" : 0, \"string\" : \"string\"}");
Do no remove, this fixes the anchor on doc.flexsim.com

JSON.stringify()

static string stringify( Variant value )

Parameters

value The Variant value.

Returns

string The resulting JSON string.

Description

Converts a Variant into a JSON string.


string str1 = JSON.stringify([0, "string"]);
Map map;
map["number"] = 0;
map["string"] = "string";
string str2 = JSON.stringify(map);