JSON Editor

Edit and normalize JSON quickly for engineering and security workflows.

About this tool

The JSON Editor combines four operations in a single editing workflow: validate (check syntax), prettify (add indentation), minify (remove whitespace), and sort keys (alphabetical recursive sort). Unlike a pure formatter, the editor lets you modify JSON inline and apply operations directly to the edited content. It is designed for cleaning up API payloads, normalizing config files before committing, and preparing JSON for code review or comparison.

Real example

Start with a minified API response payload:

{"service":"odt","env":"prod","settings":{"debug":false,"retries":3}}

Click Prettify to expand:

{
  "service": "odt",
  "env": "prod",
  "settings": {
    "debug": false,
    "retries": 3
  }
}

Click Sort Keys to alphabetize (useful before running a diff to avoid key-order noise):

{
  "env": "prod",
  "service": "odt",
  "settings": {
    "debug": false,
    "retries": 3
  }
}

Nested keys are sorted recursively - settings sub-keys are sorted too.

Common use cases

  • API response debugging: Paste raw JSON from a curl response or browser DevTools network tab, prettify it, and read the structure clearly without needing to install a JSON viewer extension.
  • Config file normalization: Before committing a config file (appsettings.json, package.json, etc.), prettify and sort keys so PR diffs show only real changes rather than formatting noise.
  • Minification for production: Before embedding a JSON payload in source code or a test fixture, minify it to reduce size and avoid trailing whitespace issues.
  • Diff preparation: Sort keys in both versions of a JSON file before comparing them with the Diff Checker. This eliminates false positives from key reordering and surfaces only value changes.

How it works

All operations parse the JSON with JSON.parse() first, so invalid JSON produces an error message before any transformation is attempted. Prettify calls JSON.stringify(obj, null, 2). Minify calls JSON.stringify(obj) without the spacing argument. Sort Keys recursively walks the object and rebuilds it with keys sorted using Object.keys(obj).sort() - arrays are preserved in order, only object keys are sorted.

Common mistakes

  • Trailing commas: JSON does not allow trailing commas after the last property or array element. {"a": 1,} is invalid JSON (it is valid JavaScript, which confuses many developers). The validator will catch this and report the exact parse error.
  • Single quotes instead of double quotes: JSON strings must use double quotes. {'key': 'value'} is invalid JSON. Replace single quotes with double quotes - the validator will identify this error.
  • Comments in JSON: JSON does not support comments (// or /* */). If your source file uses JSONC (JSON with Comments, used in VS Code configs), strip the comments before pasting here.

FAQ

Does sort keys affect arrays
No. Arrays are order-sensitive data structures and are not sorted. Only object keys are reordered alphabetically. Array elements remain in their original order.

What is the difference between this and the JSON Formatter
The JSON Formatter is designed for read-only inspection with path extraction, schema validation, and diff comparison. The JSON Editor is for quick inline editing and transformation. Use the editor for day-to-day cleanups, and the formatter for deeper structural analysis.

Can this validate against a JSON Schema
No. For schema validation, use the JSON Formatter which includes a JSON Schema subset validator.

Is my JSON sent anywhere
No. All operations run locally in your browser using JavaScript's built-in JSON object.

Related tools