# Format: JSON
## Description
Machine-readable export preserving the complete raw JSONL entry structure. Wraps all session entries in a JSON object with session metadata. Suitable for programmatic analysis, import into other tools, or archival. Renderer: `write_json_value()` in `claude_storage_core/src/export.rs`.
## Trigger
Activated by `format::json` on `.export`.
## Structure
```json
{
"session_id": "{session_id}",
"storage_path": "{storage_path}",
"entries": [
{
"uuid": "...",
"parentUuid": null,
"timestamp": "...",
"type": "user",
"message": { "role": "user", "content": "..." },
...
},
{
"uuid": "...",
"parentUuid": "...",
"timestamp": "...",
"type": "assistant",
"message": { "model": "...", "content": [...] },
...
}
]
}
```
### Content Handling
| Entry fields | All original JSONL fields preserved verbatim |
| Pretty-printing | 2-space indentation, entries at 4-space indent |
| String escaping | `"`, `\`, `\n`, `\r`, `\t` escaped per JSON spec |
| Thinking blocks | Present in raw `content` array (not filtered) |
| Tool use/results | Present in raw `content` array (not filtered) |
| Entry separator | Comma between entries, no trailing comma |
### Characteristics
- **Extension:** `.json`
- **Top-level structure:** JSON object with `session_id`, `storage_path`, `entries` keys
- **Entries array:** each element is the complete parsed-and-re-serialized JSONL line
- **Streaming:** reads raw JSONL lines via `BufReader`, parses each with the internal JSON parser, then pretty-prints. Memory holds one entry at a time.
- **Validation:** parseable with `jq .` or any JSON parser
## Source
`claude_storage_core/src/export.rs` — `write_json_value()`, `export_session()`
### Referenced Commands
| 6 | [`.export`](../command/06_export.md) | Activated when `format::json` is supplied |
### Referenced User Stories
| 3 | [Export Session for Review](../user_story/003_export_session_for_review.md) | developer |
| 4 | [Query Storage Programmatically](../user_story/004_query_storage_programmatically.md) | developer |