json_parse

Function json_parse 

Source
pub fn json_parse(args: &[Value]) -> Result<Value, RuntimeError>
Expand description

将 JSON 字符串解析为 Aether 值

§功能

解析 JSON 格式的字符串,转换为对应的 Aether 数据结构。

§参数

  • json_str: JSON 格式的字符串

§返回值

解析后的 Aether 值(Dict、Array、String、Number、Boolean 或 Null)

§映射规则

  • JSON object → Dict
  • JSON array → Array
  • JSON string → String
  • JSON number → Number
  • JSON boolean → Boolean
  • JSON null → Null

§示例

Set JSON_STR "{\"name\":\"Alice\",\"age\":30}"
Set OBJ JSON_PARSE(JSON_STR)
Println(OBJ["name"])  # 输出: Alice