Skip to main content

Module json

Module json 

Source
Expand description

JSON renderer — newline-delimited JSON output.

Every response is a single object with _meta first, plus exactly one of data (success) or error (failure):

{"_meta": {"server": "…", "auth": "…", "exit_code": 0}, "data": { … }}
{"_meta": {"server": "…", "auth": "…", "exit_code": 3}, "error": {"kind": "…", "message": "…"}}

data is an object for single-result commands and an array for list commands (Phase 4+). The shape is uniform across every command so a consumer always parses one object from stdout: if .error is present it failed, otherwise read .data. The server lives only in _meta — it is not repeated inside data. Key order is deterministic (serde_json preserve_order); _meta is always first. See ADR-0003 and ADR-0012.

Structs§

JsonRenderer
Renders output as newline-delimited JSON.