Skip to tool
Data & formats

JSON Formatter & Validator

Format, validate, minify, inspect, and query JSON with precise syntax diagnostics.

Input0 characters
Result0 characters
Ready

Prefer a native workflow?

Keep JSON Formatter & Validator one shortcut away.

DevSexy for Mac puts the same private workflow in a focused desktop app, with global shortcuts and no browser tab to manage.

Global shortcutOffline-readyLocal processing
Try the Mac app free

This browser tool remains free.

Read the structure, not just the whitespace

JSON Formatter & Validator Online — Beautify, Minify & Inspect

A formatter can make valid JSON readable. It cannot make broken JSON trustworthy. DevSexy keeps those jobs separate and shows exactly where parsing stopped.

Raw JSON

{"user":{"id":17,"roles":["editor"]}}

Parsed value

object · 1 root key · 2 nested values

Tree path

$.user.roles[0] → “editor”

From raw payload to navigable structure

Error anatomy

Line and column are clues; the preceding token is often the cause.

A missing comma or quote can surface one token later. The diagnostic keeps the parser message, offset, line, column, and nearby source together so you can repair the real boundary.

Unexpected string at line 4, column 3
2  "name": "Mole"
3  "active": true
4  "roles": ["admin"]
   ▲ comma expected before this key

Formatting choices change the diff, not the data

Indentation

Two spaces is compact, four is easier to scan, and tabs follow editor policy. All three preserve parsed values.

Key order

Sorting keys creates stable fixtures but can make human-authored configuration harder to review. It is opt-in.

Minification

Minification parses and serializes the value without layout whitespace. Duplicate keys and integers beyond JavaScript’s safe range are not preserved losslessly; use strings for large identifiers.

Strict JSON is not JSONC

Strict JSON rejects comments and trailing commas. Turn JSONC on to accept them explicitly: formatting can retain comments, while minification emits strict JSON without comments. Unquoted keys, NaN and Infinity remain invalid.

✓ Strict JSON: strings, numbers, booleans, null, arrays, objects

× Invalid in both modes: unquoted keys, NaN and Infinity

Use JSONPath after the document parses

Validate first, then use root, member, array index or wildcard selections. This implementation does not support the full JSONPath grammar, including recursive descent, filters or slices.

$[0].id$.users[*].email$.orders[*].status

Run these JSON examples

Compare the input with the expected result, then load the same data and options into the editor.

Loading an example replaces the current input and processing options.

Format a strict JSON payload

Format · 2-space indentation · JSONC off · key sorting off · JSONPath root.

Input

{"user":{"id":17,"roles":["editor"]},"active":true}

Expected result: a nested object with the same parsed values and readable indentation.

{
  "user": {
    "id": 17,
    "roles": [
      "editor"
    ]
  },
  "active": true
}

Convert commented configuration to strict JSON

Minify · JSONC on · JSONPath root. Turn JSONC off to see why the same input fails strict JSON parsing.

Input

{
  // local development
  "port": 3000,
  "enabled": true,
}

Expected result: comments and the trailing comma disappear from the serialized JSON. Format mode with JSONC on can retain comments instead.

{"port":3000,"enabled":true}

Continue the data workflow

Validate a payload against JSON Schema

Syntax-valid JSON can still miss required fields or use the wrong types; check the payload against your schema.

Convert YAML or TOML configuration

Use the configuration tool for YAML or TOML rather than trying to parse those languages as JSON.

Compare the before and after JSON

Use consistent indentation and key-order settings before comparing two versions.

Repeat the workflow in the Mac app

Keep formatting and inspection at hand with keyboard shortcuts and local offline tools.

Direct answer

What is JSON Formatter & Validator?

Format and validate JSON online, pinpoint line and column errors, inspect structure, compare indentation choices, and test JSONPath without uploading data.

What can it do?

  • Format
  • Validate
  • Minify
  • Tree

How to use JSON Formatter & Validator

  1. 01

    Choose the JSON syntax

    Leave JSONC off for strict JSON; explicitly turn it on for comments and trailing commas.

  2. 02

    Select the operation and input

    Paste a payload or load an example. Choose formatting, validation, minification, or the tree; reset JSONPath to $ for the entire document.

  3. 03

    Check the parsed result

    Review diagnostics before copying output. Preserve large identifiers as strings when JavaScript numbers cannot represent them exactly.

Frequently asked questions

Does formatting change JSON values?
It preserves parsed values for ordinary JSON with unique keys and exactly representable numbers. Serialization can change number notation and escape spelling; duplicate keys and very large integers need separate care.
Can I format a large JSON document?
Yes. Work is scheduled in a Web Worker so the page stays responsive; processing is adaptive rather than blocked by an arbitrary character ceiling.
Why does the error point after the actual mistake?
A parser usually reports where the grammar became impossible, which can be the token after a missing comma, quote, or bracket.
Is JSONPath the same as JSON Pointer?
No. JSONPath selects values with query expressions, while JSON Pointer identifies one location using slash-separated reference tokens.