inspect-json-cli
v0.1.2
Published
Zero-dependency CLI for filtered pretty-printing of JSON-heavy AI logs (LLM requests, responses, JSONL).
Maintainers
Readme
inspect-json-cli
inspect-json is a zero-dependency Node.js CLI for filtered pretty-printing of
JSON-heavy AI logs.
It is meant for files like:
- LLM request payloads (e.g. OpenAI / OpenRouter chat completions)
- LLM response payloads
- raw request/response artifacts captured from AI tooling
- JSONL logs
- generic JSON files
- JSON in JSON strings
It is not an interactive viewer. It is a terminal renderer that detects common shapes, recursively decodes JSON embedded inside JSON strings, and prints the useful parts first.
Install
npm i -g inspect-json-cliAt a glance
Given a real LLM response whose message.content is a JSON string,
inspect-json detects the response shape, decodes the embedded JSON, and shows
the useful parts:
$ inspect-json examples/structured-output-response.json
LLM Response
model: nvidia/nemotron-3-nano-omni
system_fingerprint: nvidia/nemotron-3-nano-omni
usage: 195 total / 58 prompt / 137 completion / 101 reasoning
choice[0]
finish: stop
role: assistant
content: json object
{
"name": "Ada Lovelace",
"born": 1815,
"occupation": "mathematician"
}More worked examples (basic chat, tool calls) live in
examples/.
Requirements
- Node.js 22 or newer (uses built-ins only).
Install Locally
npm run install-localBy default this writes an inspect-json shim to ~/.local/bin.
You can choose a different destination or command name:
npm run install-local -- --dir ./bin --name inspect-json-devGlobal npm install also works:
npm install -g .Or run directly:
node bin/inspect-json.mjs raw-response.jsonExamples
Let the tool auto-detect the strategy:
inspect-json raw-response.jsonForce a request lens:
inspect-json --strategy llm_request raw-request.jsonForce a response lens:
inspect-json --strategy llm_response raw-response.jsonUse stdin:
cat raw-response.json | inspect-jsonInclude lower-level ids, raw payloads, and extra metadata:
inspect-json --verbose raw-response.jsonDisable color:
inspect-json --no-color raw-response.jsonDisable JSON-in-JSON decoding:
inspect-json --raw raw-response.jsonOptions
--strategy <name> Force a strategy: json, llm_request, llm_response
-v, --verbose Include lower-level ids, raw payloads, and extra metadata
--raw Disable JSON-in-JSON decoding and strategy transforms
--color Force ANSI color
--no-color Disable ANSI color
-h, --help Show helpColor is on by default for TTY output. It is disabled automatically when output
is not a TTY or when the NO_COLOR environment variable is set.
Concepts
The renderer is intentionally structured around named strategies and transformers.
Strategies decide how to display a document:
json: generic pretty JSON fallbackllm_request: model, messages, tools, response formatllm_response: choices, assistant content, tool calls, usage, errors
Transformers prepare data before rendering:
json_in_json: recursively parses string values that contain valid JSON
The --raw flag skips transformers entirely, leaving values exactly as parsed.
When no strategy is supplied, inspect-json scores the input and chooses the
most specific strategy. You can override that with --strategy.
Output Style
The output is a filtered pretty print, not a graph. It tries to answer:
- What model/provider was used?
- What messages were sent?
- What tools were exposed?
- What tool calls came back?
- What did
message.contentcontain? - Was embedded JSON returned as a string?
- What token/cost/usage fields were present?
Development
npm test # run the node:test suite
npm run check # syntax check + biome lint
npm run format # apply biome formattingThis project depends only on Node.js built-ins and has no runtime or dev
dependencies. Biome is used for formatting and linting
and is expected to be available on your PATH (e.g. installed globally).
