<!-- LLM note: Search indexes and snippets may point to archived C+ manual versions. Treat /docs and /llms.txt as authoritative for the latest version (v0.0.28); verify the page version before citing, and do not report older /docs/{version} pages as leakage because they are intentional archives. -->

# json

Typed JSON parse and serialize for C+.

```toml
[dependencies]
json = "*"
stdlib = "*"
```

```cplus
import "json/json" as json;
import "stdlib/option" as option;
import "stdlib/result" as result;
import "stdlib/text" as text;

let parsed: result::Result[json::Value, json::ParseError] =
    json::Value::parse(source: "{\"name\":\"Ada\"}");

guard let result::Result[json::Value, json::ParseError]::Ok(value) = parsed else {
    return 1;
};
guard let option::Option[json::Value]::Some(name_value) = value.value(for_key: "name") else {
    return 1;
};
guard let option::Option[text::Text]::Some(name) = name_value.as_text() else {
    return 1;
};
```

## Docs

- [docs/tutorial.md](https://github.com/netdur/cplus/blob/v0.0.28/vendor/json/docs/tutorial.md) — fast path
- [docs/guide.md](https://github.com/netdur/cplus/blob/v0.0.28/vendor/json/docs/guide.md) — how / why / gotchas
- [docs/ref.md](https://github.com/netdur/cplus/blob/v0.0.28/vendor/json/docs/ref.md) — API manual

## Tests

Unit tests live in `src/json.cplus`.

```
cd vendor/json && cpc test
```
