JSON Viewer
Graytool's JSON Viewer lets you inspect, search, and copy log messages in a structured view.
Openingβ
To open the JSON Viewer:
- Click the π message detail button on a log row
- On first open, a field selector is shown (if no defaultMessageField is set)
- After selecting a field, the JSON Viewer panel opens
Panel Structureβ
βββββββββββββββββββββββββββββββββββββββββββββββ
β Title [β] [β‘] β β Header
βββββββββββββββββββββββββββββββββββββββββββββββ€
β [Field Selector βΌ] [π Search...] [π Copy]β β Toolbar
βββββββββββββββββββββββββββββββββββββββββββββββ€
β { β
β "userId": "12345", [β] [π] β β JSON Tree
β "request": { [β] [π] β
β "method": "POST", [β] [π] β
β "path": "/api/login" [β] [π] β
β }, β
β "level": "ERROR" [β] [π] β
β } β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β [Raw] [DevTools] [Code] β β Tabs
β βββββββββββββββββββββββββββββββββ β
β Tab content β
βββββββββββββββββββββββββββββββββββββββββββββββ
Featuresβ
Syntax Highlightingβ
JSON data is displayed with color coding:
| Element | Dark Theme | Light Theme |
|---|---|---|
| Keys | #56B6C2 (cyan) | #0066CC (blue) |
| Strings | #98C379 (green) | #22863A (dark green) |
| Numbers | #D19A66 (orange) | #B08800 (gold) |
| Booleans | #D19A66 | #B08800 |
| Null | #A0A0A0 (gray) | #6A737D (gray) |
Search and Filterβ
- Type text in the toolbar search box
- Matching keys and values are highlighted
- Use
β/βarrow keys to navigate between results - Current result is highlighted with the primary color
Row Actionsβ
Two buttons appear on hover for each JSON row:
| Button | Function |
|---|---|
| β Filter | Applies field:value to the Graylog search bar |
| π Copy | Copies the value to clipboard |
Filter button:
- Finds Graylog's search editor
- Adds a
field:valueformat query - Clicks the search button to update results
Copyβ
- π Copy All (toolbar) β Copies entire JSON to clipboard
- π Copy (row) β Copies a single value
- A
β Copiednotification appears after copying
Fullscreen / Minimizeβ
- β‘ Maximize β Panel expands to full width
- β Close β Closes the panel
Tabsβ
Raw Tabβ
Displays raw JSON text in monospace font. Ideal for direct copying.
DevTools Tabβ
Transformation tools for JSON text:
- Escape β Escapes a JSON string
- Unescape β Restores escaped text to original form
Useful for quickly fixing embedded JSON strings in log messages.
Code Tabβ
Generates code snippets from JSON data in various languages:
| Language/Tool | Description |
|---|---|
curl | cURL command |
fetch | JavaScript Fetch API |
axios | Axios HTTP client |
http | Raw HTTP request |
php | PHP code |
python | Python requests |
go | Go net/http |
java | Java HttpClient |
Tab Behaviorsβ
- Double-click β Collapse/expand tab area
- Drag β Adjust tab height
- Collapse threshold β Auto-collapses below 30px
- State persists β Collapse state saved in
localStorage
Field Selectorβ
When defaultMessageField is not set, a field selector modal is shown before opening the JSON viewer:
- Available fields are listed with radio buttons
- Each field shows a value preview (truncated to 80 characters)
- "Save as default" option can be checked
- Auto-selects if only one field is available
Keyboard Shortcutsβ
| Shortcut | Function |
|---|---|
Esc | Close JSON viewer |
/ | Focus search box |
β | Previous search result |
β | Next search result |
Notificationsβ
Notifications appear in the bottom-right corner after actions like copy and filter:
- Green β Successful operation (copy, filter)
- Red β Error
- Blue β Info
- Yellow β Warning
Notifications auto-dismiss after 3.2 seconds.