Skip to main content
Search tools
Theme

Saved on this device only.

Live tool

JSON Formatter

v1.0.0 100% Local

Free online JSON formatter, validator, and minifier. Format, validate, minify, repair, flatten, and inspect JSON locally in your browser. No data is sent to any s...

Be the first to rate Free — runs in your browser Productivity

Added Maintained by Parsepad

JSON Formatter

Live workspace

MERGE | 0 files | Auto-detect | Ready
[--:--:--] INFO Console ready. Run the tool to see activity.

Paste input above and ask a question, or use a quick action.

Guide

JSON Formatter

Format, validate, minify, repair, flatten, and inspect JSON entirely in your browser. No data leaves your device — all processing runs locally using native browser APIs.

Features

Format

Pretty-print JSON with your choice of indentation: 2 spaces, 4 spaces, or tab. Enable the Sort Keys toggle to recursively sort all object keys alphabetically, making large structures easier to compare or diff.

Minify

Strip all whitespace from JSON to produce compact output. Useful for reducing payload size, copying into config files, or comparing two structures after normalization.

Validate

Check whether input is valid JSON without modifying it. On failure, the status bar shows the exact error message along with the estimated line and column number where parsing stopped.

Repair

Apply best-effort fixes for common issues that appear in copy-pasted JSON:

  • Strip UTF-8 BOM characters
  • Remove JavaScript // line comments and /* */ block comments
  • Remove trailing commas before } or ]

Repair always reports whether it changed the input. It will not silently alter JSON during other actions — you must invoke it explicitly.

Flatten

Expand a nested JSON structure into a flat array of { path, value } rows using dot notation for object keys and bracket notation for array indices:

  • Object key path: user.address.city
  • Array item path: items[0].id

Use the Path filter input to show only paths that contain a given substring. For example, entering address returns only rows whose path includes the word address.

Extract Keys

Scan all objects in the JSON (including nested and inside arrays) and return each unique key name with the number of times it appears. Useful for understanding schema coverage in an array of heterogeneous objects.

Inspect

Return a structural summary of the JSON:

Metric Description
Characters Total character count of the input
Objects Total number of object nodes
Arrays Total number of array nodes
Keys Total number of object key occurrences
Primitives Total number of string, number, boolean, and null values
Max Depth Maximum nesting level

Settings

Setting Options Default
Indent 2 spaces, 4 spaces, Tab 2 spaces
Sort Keys On / Off Off
Path Filter Any text (empty)

Settings apply to the next action you run. Change them any time before pressing a button.

Keyboard Shortcuts

Shortcut Action
Ctrl+Enter or Cmd+Enter Format
Ctrl+Shift+M or Cmd+Shift+M Minify

Inspector Cards

The row of stat cards below the editor updates automatically after each action. It shows the validity status, input size, and structural counts for the last processed JSON.

Privacy

All processing runs locally in your browser using the native JSON.parse and JSON.stringify APIs. No JSON input, no output fragments, and no metadata are transmitted to any server. This tool works fully offline once the page has loaded.

FAQ

Why does Validate fail but Repair succeeds? Repair strips comments and trailing commas before parsing. If those were the only problems, the repaired string will be valid. Repair cannot fix structural errors such as mismatched brackets or unquoted keys.

Does Sort Keys affect array element order? No. Sort Keys only reorders object property keys. The order of elements within arrays is preserved exactly.

What does the Path Filter do in Flatten? It filters the output rows to those whose path string contains the filter text. It is a simple substring match, not a glob or regex. Leave it blank to see all paths.

Can I use this on large JSON files? Yes — paste content directly into the input area. Recursion depth is capped at 200 levels to prevent stack overflows on pathologically deep structures. Very large inputs (tens of megabytes) may take a moment to process depending on your device.

What counts as a key in the inspector? Each object property occurrence counts as one key. If you have 100 objects each with an id property, Keys will show 100, and Extract Keys will show { "id": 100 }.