Dev TooloraLocal dev tools

> Formatters

JSON Format

Format, minify or validate JSON without rounding numbers, rewriting strings or dropping duplicate keys.

Runs locallyWorks offline
Back to results
Input

Source data

Mode
Output

Result

Your result will appear here.

Tool guide

About this tool.

JSON is a text format for objects, arrays, strings, numbers, booleans and null. A complete document can also be a single scalar, not just an object or array.

Formatting adds whitespace for readability; minification removes whitespace outside strings. Validation checks the grammar without fixing or executing the source.

This tool retains the original number tokens, string escapes, key order and duplicate keys. Unlike a parse-and-stringify formatter, it does not round large numeric identifiers or rewrite 1.00 as 1.

  • Format an API response, configuration or test fixture to inspect its nested structure.
  • Minify JSON for a destination that expects a compact text payload, without removing spaces inside string values.
  • Validate syntax before copying a document elsewhere, and inspect duplicate-key or numeric-range warnings.
  • Use JSON Schema Validator for required properties and data types; syntax validation alone does not check application rules.

Paste one JSON document or choose a sample. Select Format, Minify or Validate; all three modes check the same strict grammar.

For Format, choose two spaces, four spaces or tabs and LF or CRLF line endings. These settings do not affect Minify or the validation report.

Run the tool. Invalid input reports a one-based line and column plus a zero-based UTF-16 offset; fix the source at that location and run again.

Inspect the summary for duplicate keys or numbers outside JavaScript’s safe range. Choose Validate to read warning details; warnings do not modify the source.

Copy or download the result. Formatting and minification produce a JSON file; validation produces a text report, not a corrected document.

  • {"id":9007199254740993,"price":1.00} → both numeric tokens stay exactly 9007199254740993 and 1.00.
  • { "message": "a b", "escaped": "\u0061" } → {"message":"a b","escaped":"\u0061"} in Minify.
  • {"role":"user","role":"admin"} → both members kept, unchanged apart from whitespace, plus a duplicate-key warning.
  • null → Valid JSON, Type: null; null is not reported as an object.
  • {"ok":true,} → a "Trailing commas are not valid JSON" error at line 1, column 12; nothing is repaired.

  • Runs locally and offline. JSON is never executed, uploaded or used to fetch remote content.
  • Strict JSON only: double-quoted keys and strings, no comments, trailing commas, single quotes, NaN, Infinity, undefined or JavaScript expressions. A single leading byte order mark (U+FEFF) is ignored and not written to the output.
  • Only whitespace outside strings changes. Original key order, escapes, negative zero, decimal trailing zeroes and exponent notation are retained; keys are not sorted.
  • Duplicate keys are valid grammar but unreliable across consumers. The tool preserves all occurrences and reports their decoded names, including equivalent escaped keys.
  • Number spelling is preserved even beyond JavaScript’s range. A warning is not a complete precision analysis: ordinary decimals may also be rounded by downstream consumers. Quote identifiers if the receiving system requires strings.
  • Supports up to 1,000,000 UTF-16 input characters, 100,000 values and 128 nested containers. Formatted output is limited to 8,000,000 characters.
  • Validation reports root type, values, containers, maximum container depth and warning counts. Values include the root and array/object values, not object keys; at most 20 warning details are shown.
  • Syntax validation does not check a JSON Schema, business rules, duplicate-key safety or Unicode interoperability. Unpaired surrogate escapes are accepted by JSON grammar and retained.
  • The original JSON Minify and JSON Validate URLs and commands still work, defaulting to their respective modes; they share this workspace and guide.

FAQ

Questions about JSON Format

Does JSON Format sort keys alphabetically?

No. Keys stay in their original order, including duplicates, because only whitespace outside strings changes. There is no sort option, so reorder the keys in the source if you need a canonical order.

Why is valid-looking JSON rejected at line 1, column 1?

The first character is not part of a JSON value. A common cause is a non-breaking space or another invisible character copied with the text; only spaces, tabs and line breaks count as JSON whitespace. One leading byte order mark (U+FEFF) is ignored, but a second one is rejected. Delete the hidden character and run again.

Can JSON Format repair invalid JSON?

No. Comments, trailing commas, single quotes and unquoted keys are reported with a line and column instead of being fixed, so nothing in your data changes silently. Correct the source at that position and run again.

Will formatting change numbers such as 1.00 or large IDs?

No. Every number keeps its exact spelling, so 1.00 stays 1.00 and 9007199254740993 is not rounded. Numbers outside JavaScript’s safe range get a warning, because the program that later reads the JSON may still round them.

What is the difference between Format, Minify and Validate?

Format adds indentation and line breaks, Minify removes all whitespace outside strings, and Validate returns a report with the root type, value counts, depth and warnings instead of JSON. All three modes check the same strict grammar.

Is my JSON uploaded anywhere?

No. Formatting, minifying and validation run locally in your browser, editor or desktop app. The JSON is never uploaded, executed or used to fetch anything.

Continue with

JSON TreeExplore JSON in an expandable, searchable tree with exact scalar tokens, types and JSON Pointer paths.JSON QueryExtract exact JSON values using a simple path or JSON Pointer copied from Tree and Diff.JSON DiffCompare JSON structures with precise numbers, index-level array changes and clear before/after values.JSON Schema ValidatorValidate JSON locally with draft-aware rules, format checks and precise error paths without eval.