-
Notifications
You must be signed in to change notification settings - Fork 0
API JSON
Liu.Yandong.Hanks edited this page Aug 19, 2026
·
3 revisions
JSON 解析与序列化
JSON parsing and serialization
Overview
JSON 用于在 AuroraScript 值与 JSON 文本之间转换。支持普通对象、一般数组、Packed Array、HashMap 与可序列化的基础值;循环引用不能序列化。
JSONconverts between AuroraScript values and JSON text. It supports ordinary objects, general arrays, packed arrays,HashMap, and serializable primitive values; circular references cannot be serialized.
Parameters:
-
text
有效的 JSON 字符串。Valid JSON string.
Returns
对应的 AuroraScript 值。
The corresponding AuroraScript value.
边界行为
格式错误的文本会产生运行时错误。
Malformed input raises a runtime error.
var config = JSON.parse('{"name":"Aurora","enabled":true}');
return config.name;Parameters:
-
value
待序列化值。Value to serialize.
-
indented
可选布尔值,true时输出缩进文本。Optional Boolean;
trueproduces indented output.
Returns
JSON 字符串。
JSON string.
边界行为
遇到循环引用会抛出运行时错误。
A circular reference raises a runtime error.
var text = JSON.stringify({ name: "Aurora", values: [1, 2] }, true);
return text.contains("\n"); // trueAuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License