# json

A typed-enum JSON parser and serializer. `Value` is a recursive enum:

```text
Null | Bool(bool) | Number(f64) | Str(string) | Array(Vec[Value]) | Object(Vec[Member])
```

The entry points are `json::parse(s: str) -> Result[Value, ParseError]` and `v.to_string() -> string` (shortest-round-trip number formatting, with surrogate pairs handled). Read values back through the `is_*` / `as_*` / `array_*` / `object_*` accessors. Dropping the outer `Value` recursively drops its payloads.

```cplus
import "json/json" as json;

guard let result::Result::Ok(v) = json::parse("{\"x\":42}") else { return 1; };
if v.is_object() {
    guard let option::Option::Some(x) = v.object_get("x") else { return 0; };
    println(x.as_number() as i32);   // 42
}
```
