neco-json5
zero dependency JSON5 subset parser.
Features
- Object parsing with unquoted, single-quoted, or double-quoted keys
- Scalar parsing for null, bool, number, and string values
- Array parsing with comma-separated scalar values
- Object fields stored in source order as
Vec<(String, Json5Value)> ParseErrorwith byte-oriented position and message
Usage
Parse
use ;
let value = parse.unwrap;
assert!;
Read fields
use ;
let value = parse.unwrap;
let Map = value else ;
assert!;
API
| Item | Description |
|---|---|
parse(input: &str) -> Result<Json5Value, ParseError> |
Parses the supported JSON5 subset |
Json5Value |
Null, Bool, Number(f64), String, List, or ordered Map |
ParseError |
Reports byte position and message |
Format support
The supported subset covers configuration-shaped JSON5 object documents, common scalar values, and scalar arrays. It keeps duplicate object keys in order and does not implement the full JSON5 grammar.
License
MIT