# JSON.strict 库模块帮助文档

[严格 JSON 解析](https://www.aardio.com/zh-cn/docs/library-guide/std/JSON/strict.html)

## JSON.strict 成员列表 <a id="JSON.strict" href="#JSON.strict">&#x23;</a>

显式导入的严格 JSON 解析器。不修改普通 JSON.parse/stringify。  
UTF-8、顶层任意 JSON 值；默认拒绝重复解码键、孤立代理项及 BOM。

### JSON.strict.parse(文本,选项表) <a id="JSON.strict.parse" href="#JSON.strict.parse">&#x23;</a>
成功返回解析值，错误抛出异常。  
null 成功返回 null；数组用 table.len/table.eachIndex。  
选项：maxBytes=8388608，maxDepth=128，duplicateKeys="reject"或"last"，allowBom=false，largeIntegers="auto"/"string"/"error"/"number"。  
auto：安全整数为number，大正整数到uint64为math.size64，其他超范围整数报错；详见指南。

### JSON.strict.tryParse(文本,选项表) <a id="JSON.strict.tryParse" href="#JSON.strict.tryParse">&#x23;</a>
成功返回值；失败返回 null,错误信息,诊断表。  
必须检查第二返回值，不能用首返回值区分 null/false/0 成功。  
诊断含 code/message/byte/line/column，位置1起始、column按UTF-8字节计。

### JSON.strict.validate(文本,选项表) <a id="JSON.strict.validate" href="#JSON.strict.validate">&#x23;</a>
仅扫描和校验，不构造结果树；成功true，失败null,错误信息,诊断表。  
采用与parse相同语法、Unicode、重复键、数值表示及限额策略；不是只校验RFC语法。
