Overview
Reference usage
Inspector for structured payloads. Presents a payload as data first: labelled fields by default, with a Fields / JSON switch for the raw JSON tree, a visible label, byte size, truncation state, and a single copy action.
Overview
PayloadInspector wraps JsonViewer, Badge, and CopyButton into a single component optimized for operational dashboards — workflow engines, API consoles, webhook debuggers, and background job UIs. Pass any JSON-serializable value; the inspector handles parsing, copy affordances, and edge cases.
Edge cases handled out of the box:
null,boolean,number, and plain strings — shown inline as primitives- Arrays and objects — listed as labelled fields (property names formatted as labels, IDs and hashes in small monospace, nested objects and arrays as indented sub-lists); the Fields / JSON switch in the heading row shows the collapsible JSON tree instead
- Invalid JSON strings — shown with a parse error notice above the raw text
- Empty / no payload — shows a "No payload" placeholder
- Oversized payloads — a notice replaces the fields, and JsonViewer's built-in cap protects the JSON view
- Truncated payloads — a badge in the heading row indicates producer-side truncation
- Circular references and non-serializable values (e.g. BigInt) — an explanatory message renders instead of the tree; size reads "Unknown size"
Usage
With a JSON string
When your data arrives as a serialized string (e.g. from a message queue or API response body), pass it directly. The component parses it automatically:
With truncation flag
When the producer truncates a payload before sending (e.g. due to wire limits), set truncated to signal this to the reader:
Copy behavior
The copy button in the heading row copies pretty-printed JSON of the parsed value. When the payload itself is a string — including a JSON-encoded string primitive like '"hello"' — it copies that original string verbatim instead, so the copied text always matches what was actually passed as value. It is hidden for empty and unserializable payloads.
Redacting sensitive fields
Redact the payload before passing it as value — the inspector renders exactly what it receives:
Custom parser for non-JSON formats
Pass a parse function to support alternative serialization formats:
Accessibility
The root element is a plain <div> — not a landmark — so a dashboard rendering many inspectors adds nothing to the screen reader's landmark list. The visible label names the panel, and the JSON tree is cinder's JsonViewer, a WAI-ARIA tree composite; see json-viewer accessibility documentation for its keyboard contract.
Parse errors render with role="alert" for immediate announcement. Empty states use role="status". The byte size span carries an aria-label like "13 B payload size" for screen readers that skip the visual context. See payload-inspector.a11y.md for the full pattern.
- User ID
u_8f2a3b- Action
- checkout
- Cart
- Items
- 1
- ID
p_001- Name
- Widget
- Qty
- 2
- Price
- 19.99
- 2
- ID
p_002- Name
- Gadget
- Qty
- 1
- Price
- 49.95
- Total
- 89.93
- Timestamp
- 2026-06-11T14:22:00Z
- Flags
- Guest Checkout
- false
- Promo Applied
- true
When to use
- Inspecting workflow inputs, signal payloads, activity results, or API response bodies in a dashboard.
- Displaying a structured payload with a visible label, byte size, and copy affordance.
- Reading a payload as data first, with the raw JSON one switch away.
- Rendering a raw code block only — use code-block directly instead.
- Needing search, filtering, or virtualization over large collections — compose a custom viewer.
Examples
Basic payload inspector
Inspect a structured object payload as an interactive tree with a copy action and byte size.
Edge cases
Demonstrates null, invalid JSON, and empty payload states in the inspector.
Signal payload
Inspect a workflow signal payload — a common pattern in activity result dashboards.
Workflow input
Inspecting a workflow launch payload with signal input, retry policy, and schedule metadata.
Props
Name | Type | Default | Description |
|---|---|---|---|
value | unknown | The payload value to inspect. Pass any JSON-serializable value — object,
array, string, number, boolean, or null. Plain strings are rendered as
string values; strings that look like serialized JSON are parsed. Pass
undefined when no payload is available yet. | |
truncated | boolean | false | When true, the payload has been truncated by the producer (e.g. because it exceeded a wire size limit). The inspector renders a truncation badge in the header. |
initialDepth | number | 1 | Initial collapse depth for the JSON tree. Nodes deeper than this start collapsed. Defaults to 1. |
maxDepth | number | 50 | Hard depth cap for the JSON tree. Nodes deeper than this never render their children. Defaults to 50. |
maxBytes | number | 1048576 | Maximum byte size before the tree view is replaced with an oversize placeholder. Defaults to 1,048,576 (1 MB). |
parse | (raw: string) => unknown | Custom parser applied when value is a string. Receives the raw string
and must return a parsed value or throw. Defaults to JSON.parse. Use this
to support alternative serialization formats. | |
label | text | 'Payload inspector' | Visible header label for the inspector. Defaults to "Payload inspector". |
view bindable | 'fields' | 'json' | 'fields' | Which view a structured payload (an object or array) shows. 'fields'
lists each property with a formatted label; 'json' shows the collapsible
JSON tree. Bindable, and switched by the Fields / JSON control in the
heading row. A value that is not structured has one view and no control. |
linkFor | (field: PayloadInspectorField) => stringundefined | Returns the address a value in the Fields view leads to, so a value that
names something (a run, a workflow, a user) can link to it. Return
undefined to leave the value as text. The JSON view is never linked. |