Skip to content

API JSON

Liu.Yandong.Hanks edited this page Aug 21, 2026 · 3 revisions

JSON

JSON parsing and serialization API.

Script API Reference

Overview

JSON converts between AuroraScript values and JSON text. It is a static object with no constructor.

Ordinary objects, general arrays, packed arrays, HashMap, and serializable primitive values are supported.

Tip

JSON targets standard interoperability and can reduce runtime types to plain objects, arrays, or strings. Use TDoc when AuroraScript type identity has to survive a round trip.

Methods

JSON.parse(text)

Parameters

Name Type Required Description
text string Yes Valid JSON text.

Returns

any — the corresponding AuroraScript value.

Behavior

Malformed input raises a runtime error.

Example

var config = JSON.parse('{"name":"Aurora","enabled":true}');
return config.name; // "Aurora"

JSON.stringify(value, [indented])

Parameters

Name Type Required Description
value any Yes Value to serialize.
indented boolean No true produces indented output.

Returns

string — the JSON text.

Warning

A circular reference cannot be serialized and raises a runtime error. Break the cycle before serializing.

Example

var text = JSON.stringify({ name: "Aurora", values: [1, 2] }, true);
return text.contains("\n"); // true

Clone this wiki locally