Nifty / Extensions / Data & formats
Nifty JSON
Format, minify, sort keys, query with JSONPath, copy paths, generate TypeScript types, and browse huge JSON files in a fast tree view.
code --install-extension nifty.nifty-json
Works in VS Code, Cursor, Windsurf, VSCodium and in the browser on vscode.dev and github.dev. Free.
Try it without installing anything: JSON Formatter · JSON Validator · JSON Minifier · JSON Escape · JSON Unescape · JSONPath Tester
Features



- Format without surprises. Pretty-prints the document or just the selection, and keeps comments, key order and number literals (
1.0,12345678901234567890) exactly as written. Works on JSON and JSONC. - Minify. Strips whitespace and comments in one step.
- Sort Keys. Sorts every object recursively in natural order (
k2beforek10), ascending or descending. - Copy Path at Cursor. Puts the path of the key under the cursor on the clipboard as JSONPath (
$.users[0].name), jq (.users[0].name) or JavaScript (users[0].name). - Query with JSONPath. Filter and extract data, e.g.
$.items[*].nameor$..book[?(@.price < 10)]. Results open beside your file. Filters run in a safe evaluator, never as arbitrary code. - Generate TypeScript Types. Turns sample data into interfaces. Array items are merged, so keys that only some items have become optional.
- Escape / Unescape. Converts a selection to or from a JSON string literal, which is handy for JSON embedded in JSON.
- Tree View for large files. Opens JSON files that are too big for the editor (up to 512 MB by default) and loads children only when you expand them. Hover any node to copy its path or value. Right-click a
.jsonfile in the Explorer to open it straight in the tree.
Find everything under Nifty JSON in the Command Palette, or in the editor's right-click menu.
Commands
| Command | What it does |
|---|---|
Nifty JSON: Format Document or Selection |
Pretty-print, keeping comments and literals |
Nifty JSON: Minify |
Remove whitespace and comments |
Nifty JSON: Sort Keys |
Sort object keys recursively |
Nifty JSON: Copy Path at Cursor |
Copy the path of the key under the cursor |
Nifty JSON: Query with JSONPath |
Run a JSONPath query and open the results |
Nifty JSON: Generate TypeScript Types |
Create interfaces from the data |
Nifty JSON: Escape Selection as JSON String |
Wrap and escape the selected text |
Nifty JSON: Unescape JSON String |
Turn a JSON string literal back into text |
Nifty JSON: Open Tree View (Large Files) |
Browse the current or a picked file as a lazy tree |
Settings
| Setting | Default | What it does |
|---|---|---|
nifty.json.indent |
auto |
Indentation: the editor's setting, 2, 4, 8 or tab |
nifty.json.sort.order |
asc |
Sort Keys order: asc or desc |
nifty.json.sort.caseSensitive |
false |
Treat upper and lower case as different when sorting |
nifty.json.pathFormat |
jsonpath |
Copy Path style: jsonpath, jq or javascript |
nifty.json.types.rootName |
Root |
Name of the top-level generated type |
nifty.json.tree.pageSize |
200 |
Children loaded at a time in the tree view |
nifty.json.tree.maxFileSizeMB |
512 |
Largest file the tree view will open |