JSON / YAML / XML Swiss Army Knife

Parse. Edit. Convert. Query. Diff. All in one tab.

A full-featured editor and toolkit for structured data formats — JSON, YAML, and XML — that runs entirely in your browser. No installation, no server, no data ever leaving your machine. Open a file, paste text, or fetch from a URL and start working immediately.

Pretty-print, minify, validate against a schema, query with JSONPath or XPath, diff two documents, convert between formats, encode/decode strings, and edit the live tree — all from a single HTML file.

Free Private No sign-up Works offline

User Manual

Overview

The Swiss Army Knife is a browser-based editor for JSON, YAML, and XML documents. Everything runs locally — no data is sent anywhere. The editor is powered by CodeMirror 5 with syntax highlighting, code folding, bracket matching, and real-time validation. The status bar at the bottom shows the current format, node count, nesting depth, gzipped size estimate, and any parse errors.

Getting Started

Opening a document

Saving / copying

Selecting a format

Use the JSON / YAML / XML buttons in the toolbar to set the active format. The editor's syntax highlighter and validator switch accordingly. The format can also change automatically when you convert a document.

The Toolbar

The toolbar runs across the top of the page. Buttons are grouped by function:

ButtonAction
↩ / ↪Undo / Redo (also Ctrl+Z / Ctrl+Y)
PrettyFormat and indent the document
MinifyStrip all whitespace
ClearEmpty the editor
🕑 RecentOpen a recently used document from the history list
📂 OpenPick a file from disk
🌐 URLFetch content from a URL
📋 CopyCopy editor content to clipboard
💾 SaveDownload content as a file
🔄 ConvertToggle the conversion panel
⚙️ TransformToggle the transformation panel
🔍 QueryToggle the query panel
📋 SchemaToggle the schema panel
⚡ DiffToggle the diff panel
🔐 EncodeToggle the encoding panel
🌲 TreeToggle the interactive tree view
Show keyboard shortcuts

Named Tabs

The tab bar below the toolbar lets you work on multiple documents at the same time. Each tab stores its own content, format, and name independently in localStorage.

The Editor

The main editing area is a full-featured CodeMirror 5 editor.

Status Bar

The strip at the bottom of the editor shows live information about the current document:

FieldMeaning
FormatJSON / YAML / XML — the active parse format
NodesTotal number of keys and values in the document
DepthMaximum nesting level
~gzipEstimated gzipped size of the document
ErrorParse error message and line number (if any)
⚠ duplicatesWarning if duplicate keys are found in a JSON object

Tree View

Click 🌲 Tree to open a collapsible tree panel alongside the editor. The tree reflects the parsed document in real time and supports interactive editing.

Navigating the tree

Editing in the tree

Menu itemAction
Add keyAdd a new key-value pair inside an object
Add itemAppend a new item to an array
Rename keyRename the current key
DeleteRemove this node from its parent
Copy pathCopy the JSONPath to this node to the clipboard
Copy valueCopy the serialized value of this node to the clipboard

All tree edits are written back to the editor immediately and can be undone with Ctrl+Z.

Tree editing is supported for JSON and YAML. XML documents can be viewed but not edited via the tree.

Drag-and-drop reorder

Drag a tree row to reorder it within its parent. You can reorder items in arrays and keys in objects. Only siblings (nodes with the same parent) can be swapped — you cannot drag a node to a different level.

Convert Panel

Click 🔄 Convert to open the conversion panel. The current document is converted on the fly.

ConversionNotes
JSON → YAMLReplaces the editor content with the YAML equivalent
YAML → JSONReplaces the editor content with the JSON equivalent
JSON ↔ XMLKeys starting with @ become XML attributes; #text becomes text content
XML → JSONParses the XML and produces a JSON representation
JSON → CSVWorks on a top-level array of objects; columns are derived from the first row's keys
CSV → JSONSupports comma, semicolon, and tab delimiters; first row is treated as headers
JSON → INIProduces a flat INI file from a top-level object; nested objects become [sections]
INI → JSONParses an INI file back to a JSON object
→ Markdown tableRenders a top-level array of objects as a Markdown table
For JSON↔XML conversions the editor format switches automatically after conversion.

Transform Panel

Click ⚙️ Transform to apply structural transformations to the parsed document.

TransformWhat it does
Sort keys A→ZRecursively sorts all object keys alphabetically
Sort keys Z→ARecursively sorts all object keys in reverse
Sort array by fieldSorts a top-level array of objects by a chosen key; supports ascending and descending
Remove nullsDeletes all keys whose value is null
Remove empty stringsDeletes all keys whose value is ""
Remove empty arraysDeletes all keys whose value is []
FlattenCollapses nested objects to dot-notation keys (e.g. a.b.c)
UnflattenExpands dot-notation keys back to a nested structure
Rename keysBulk find-and-replace on key names across the entire document
JS transformApply a custom JavaScript expression — receives the parsed value as data, must return the new value
The JS transform field accepts any expression, e.g. data.filter(x => x.active) or Object.fromEntries(Object.entries(data).reverse()).

Query Panel

Click 🔍 Query to run queries against the current document.

JSONPath

Run JSONPath expressions against JSON or YAML documents.

SyntaxMeaning
$Root of the document
.keyChild key
[n]Array index
[*]All items in an array
..keyRecursive descent — find key at any depth
?(expr)Filter — e.g. $.items[?(@.price > 10)]

Results are shown as a JSON array below the query field.

XPath

Run XPath 1.0 expressions against XML documents (or against JSON/YAML after conversion to XML). Uses the browser's native document.evaluate().

Regex filter

Filter the raw text of the document by regular expression. Matching lines are highlighted in the output.

Flatten to table

Takes a top-level array of objects and displays it as a sortable HTML table for quick visual inspection.

Schema Panel

Click 📋 Schema to work with JSON Schema.

Validate against schema

Paste a JSON Schema into the schema field and click Validate. Validation uses Ajv 6 and reports all errors with their paths and messages.

Infer schema

Click Infer schema to generate a JSON Schema from the current document. The inferred schema captures types, required fields, and nested structure.

Generate mock data

Click Generate mock to produce a sample document that conforms to the current schema. Useful for testing and placeholder data.

Infer TypeScript types

Click Infer TS types to generate TypeScript interface definitions from the current JSON document. Nested objects become named interfaces in PascalCase.

Diff Panel

Click ⚡ Diff to compare two documents.

Text diff

Paste two documents into the left and right text areas and click Text diff. A line-by-line diff is shown below, with added lines in green and removed lines in red. The diff is capped at 300 lines per side to keep the UI responsive.

Semantic diff

Click Semantic diff to compare the two documents structurally, independent of formatting or key order. Each difference is reported as a path with the old and new values — ideal for spotting what actually changed between two versions of an API response.

Encode Panel

Click 🔐 Encode to encode or decode strings. Type or paste into the input field and click the operation button.

OperationDescription
Base64 encode / decodeStandard Base64; handles Unicode correctly
URL encode / decodeencodeURIComponent / decodeURIComponent
HTML unescapeConverts &, <, etc. back to characters
Unicode escape / unescapeConverts to/from \uXXXX notation
JSON string escape / unescapeEscapes a raw string for use inside a JSON string value, and the reverse

Recent Documents

The last 10 documents you worked with are saved automatically in localStorage. Click 🕑 Recent to browse them. Each entry shows the format, a size indicator, and a timestamp. Click an entry to restore the document into the current tab.

URL Fetch

Click 🌐 URL to open the URL panel. Enter any URL that returns JSON, YAML, or XML and click Fetch. The response is loaded into the editor and parsed automatically. CORS restrictions apply — some endpoints may not be fetchable from a browser page.

Keyboard Shortcuts

Click in the toolbar to see the full shortcut reference. The most commonly used shortcuts:

ShortcutAction
Ctrl+ZUndo
Ctrl+Y / Ctrl+Shift+ZRedo
Ctrl+PPretty-print
Ctrl+MMinify
Ctrl+SSave / download file
Ctrl+OOpen file
Ctrl+DToggle dark/light theme
Ctrl+TToggle tree view
Ctrl+/Toggle comment (in editor)
TabIndent selected lines
Shift+TabDedent selected lines

Theme

The app starts in dark mode (Catppuccin Mocha palette). Click the moon/sun icon or press Ctrl+D to toggle to light mode. Your preference is saved in localStorage.

Privacy

The Swiss Army Knife processes everything locally in your browser. No data is transmitted to any server — not the documents you paste, not the schemas you validate against, not the URLs you fetch content from. The only network request the app makes is when you explicitly click 🌐 URL to fetch a remote document.

All persistent state (tabs, recent documents, theme preference) is stored in localStorage in your browser and never leaves your device.

Supported Formats

.json  ·  .yaml  ·  .yml  ·  .xml

About this tool

Technologies used:

CodeMirror 5 js-yaml 4.1.0 Ajv 6.12.6 jsonlint 1.6.0 File API localStorage CompressionStream API Vanilla JS

Built with:

Claude Sonnet 4.6

← Back to Bunka.be