Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Document & Text
  3. JSON Formatter & Validator
Add to favorites

JSON Formatter & Validator

Format, validate and minify JSON, JSONC or JSON5 as you paste, with exact numbers, precise error locations, a tree view, JSONPath queries and schema checks.

Text processed locallyMore document & textJump to full guide
Related readingXML and XPath: Understanding Structured Data and Powerful Queries12 minJSON Best Practices: Structure, Validation, and Common Mistakes9 min

Initializing in your browser…

You might also like

XML Formatter & Tools

Format, minify or convert XML to JSON as you type, with line-and-column error checks, a tree view and XPath queries that handle namespaces.

YAML Formatter & Converter

Format and validate YAML or convert between YAML and JSON as you type, keeping comments, anchors and exact numbers, with YAML 1.1 and 1.2 support.

JSON Schema Generator

Generate a JSON Schema (draft 2020-12 or draft-07) from a JSON document as you paste, with detected formats and a check that your document validates.

JSON Formatter & Validator: a worked example

An API returned a single minified line with an order identifier and a price, and you need to read it before filing a bug about a wrong order number.

Minified response

{"orderId":12345678901234567890,"price":19.90,"active":true}
What JSON Formatter & Validator produces

Formatted, values unchanged

{
  "orderId": 12345678901234567890,
  "price": 19.90,
  "active": true
}

line 1:12  12345678901234567890 is kept exactly as written. A program that
           reads it as a standard double gets 12345678901234567000,
           a different number.
line 1:41  19.90 is kept exactly as written. Tools that convert numbers
           to doubles would write it as 19.9.

The output differs from the input only in whitespace. The two notes explain the bug you may be chasing: the ID has 20 digits, more than a 64-bit float can hold exactly, so any service that parses it with a standard JSON library will see 12345678901234567000 and look up the wrong order. The price note is harmless (19.90 and 19.9 are the same value) but explains why a re-serialised copy looks different. Sending large IDs as strings avoids the problem.

About the JSON Formatter & Validator

Paste JSON to format, validate or minify it instantly, with clear error messages that point to the exact line and column. Explore the result as a tree, run JSONPath queries, compare two documents and check them against a JSON Schema, all in your browser and without changing a single value.

How it works

JSON is easy to read once it is indented and nearly impossible when an API returns it as one long line. This formatter lays it out as soon as you paste, colours keys, strings and numbers, and tells you immediately whether the document is valid. When it is not, you get the line, the column, the offending line with a caret under the problem and a plain description of what went wrong, such as a missing comma or a closing bracket of the wrong kind.

Nothing changes but the whitespace. Many online formatters run the text through JSON.parse and JSON.stringify, which converts every number to a 64-bit float. That quietly turns an order ID like 12345678901234567890 into 12345678901234567000 and writes 19.90 as 19.9. This tool keeps the exact text of every number, string and key, so the formatted output is the same data with new spacing. If a number would be altered by a typical JSON library, a note says so, which is useful when you are chasing a bug where an ID changes between systems.

JSON with comments and JSON5. Configuration files such as tsconfig.json and VS Code settings allow comments and trailing commas, and JSON5 adds unquoted keys, single quotes, hexadecimal numbers and Infinity. Choose the dialect under Read as and the tool reads them correctly. The output is always standard JSON; any value that standard JSON cannot write the same way (for example 0xFF or a leading plus sign) is listed with what it became and why.

Repeated keys and key order. The JSON standard says keys should be unique but does not forbid repeats, and most parsers silently keep only the last one. The formatter points out every repeated key and lets you keep them all, keep the first or keep the last. Keys can stay in their original order or be sorted, either by Unicode code point for stable diffs or by the rules of your language.

Tree, query, compare and schema. The Tree view lets you fold and unfold large structures. The Query view runs JSONPath expressions such as $.items[*].sku or $..price, with suggestions built from your document, and shows results with the original digits intact. Compare lists every key that was added, removed or changed between your document and a second version, ignoring formatting. The schema check validates the document against a JSON Schema covering type, required, properties, additionalProperties, items, enum, minimum, maximum, minLength and maxLength, and names any keyword it does not check. Everything runs locally; documents up to about 400 KB format as you type, and larger files format when you press the button.

How to use

  1. 1Paste JSON into the Input box, open a .json file, or press Try an example. The formatted result appears on the right as you type.
  2. 2If the document has comments, trailing commas or JSON5 syntax, change Read as to JSON with comments or JSON5.
  3. 3Choose Format or Minify, and set the indent and key order you want.
  4. 4Fix any error using the line, column and highlighted excerpt shown in place of the output.
  5. 5Switch to Tree to browse, Query to run a JSONPath expression, or Compare to check a second version.
  6. 6Copy the result or download it as a .json file. Open Validate against a JSON Schema to check the structure.

Key features

  • Live formatting and validation as you paste or type
  • Exact output: large integers, trailing zeros and every string kept as written
  • Error messages with line, column, an excerpt and a caret
  • Reads standard JSON, JSON with comments (JSONC) and JSON5
  • Format with 2, 3 or 4 spaces or tabs, or minify to one line
  • Repeated keys reported, with a choice to keep all, first or last
  • Key sorting by code point or by your language
  • Collapsible tree view and in-output search
  • JSONPath queries with suggestions based on your data
  • Key-by-key comparison of two documents and JSON Schema validation

When to reach for this

  • Reading an API response

    Paste a minified response from a browser network tab or a log and read it as an indented, coloured document, then pull out the fields you need with a JSONPath query.

  • Fixing a broken config file

    Find the missing comma or stray bracket in a package.json, tsconfig.json or settings file from the exact line and column of the error.

  • Checking that a payload matches a contract

    Validate a request or response body against its JSON Schema before sending it, and see each failing field by path.

  • Spotting what changed between two versions

    Compare yesterday's and today's export key by key, without the noise of formatting differences.

Tips & best practices

  • Sort keys by code point before comparing two exports in a text diff tool; the order then no longer hides real changes.
  • Use Minify for payloads you paste into a test or a command line, and Format with tabs or 2 spaces to match your project style.
  • Click a suggested query in the Query view to learn JSONPath from your own data, then edit it.
  • If an ID looks different in two systems, paste the raw response here: a precision note shows whether a float conversion is the cause.

Examples

  • A 20-digit order ID

    {"orderId":12345678901234567890,"price":19.90} formats to two indented lines that still read 12345678901234567890 and 19.90. A note explains that a standard JavaScript parser would read the ID as 12345678901234567000.

  • A tsconfig with comments

    A tsconfig.json with // comments and a trailing comma fails as plain JSON with the line and column of the first comment. Switch Read as to JSON with comments and it formats cleanly.

  • A JSONPath filter

    On {"items":[{"sku":"a-1","qty":2},{"sku":"b-2","qty":5}]} the query $.items[?(@.qty > 3)].sku returns ["b-2"].

Frequently asked questions

Why does my JSON say it is invalid?

The most common causes are a missing or extra comma, single quotes instead of double quotes, unquoted keys, comments, or a trailing comma after the last item. The error panel shows the line and column with a caret at the problem. If the file is a configuration file that allows comments, choose JSON with comments or JSON5 under Read as.

Will formatting change my numbers?

No. Each number is written back exactly as it appears in your document, including large integers and trailing zeros. Many formatters convert numbers to floating point, which can change IDs longer than about 15 digits; this one does not.

What is the difference between JSON, JSONC and JSON5?

JSON is the strict standard (RFC 8259). JSON with comments adds // and /* */ comments and trailing commas, as used by VS Code and TypeScript config files. JSON5 also allows unquoted keys, single-quoted strings, hexadecimal numbers, Infinity and NaN. The output is always standard JSON.

What happens to duplicate keys?

They are reported with their line and column. By default every copy is kept so nothing disappears; choose Keep the first or Keep the last under Repeated keys to remove the extras. Most JSON libraries keep only the last value without warning.

Which JSONPath syntax is supported?

The common Goessner syntax: $ for the root, .name and ['name'] for keys, [0] and [-1] for indexes, [0:3] slices, [0,2] lists, [*] and .* wildcards, ..name for recursive search and filters such as [?(@.price > 10)] or [?(@.status == "active")].

How large a file can I format?

Documents up to about 400 KB update as you type. Larger files format when you press Format now, so typing stays responsive. The practical limit is your browser's memory, since nothing is uploaded.

Is my data sent to a server?

No. Parsing, formatting, queries, comparison and schema checks all run in your browser. The share link stores only your settings, never the document.

Related tools and how they differ

  • JSON Schema Generator: Generates a JSON Schema from a sample document, which you can then use for validation here.
  • YAML Formatter & Converter: Formats YAML and converts between YAML and JSON.
  • CSV to JSON Converter: Turns spreadsheet data into JSON you can then format and query here.

Further reading

  • XML and XPath: Understanding Structured Data and Powerful Queries12 min read
  • JSON Best Practices: Structure, Validation, and Common Mistakes9 min read

Private by design

Your text is processed locally in the browser. Nothing you paste or open is transmitted or logged.