A little help for everyday work.
Free to useFind a tool
Developer tools

JSON Formatter

Format, minify and validate JSON with useful errors.

⌑ Runs in your browserNo sign-up needed
01

Your inputs

Your inputs and files stay on your device.

02

Your result

◎

A little input. A useful answer.

Enter your values and run the tool to see your result here.

How to use it

  1. Paste JSON or select a local JSON file.
  2. Choose formatting, minification, validation or recursive key sorting.
  3. Process the JSON, then copy or download the result.

The method

The browser parses JSON and serializes the resulting value with your chosen indentation. Key sorting preserves array order.

For example

{"b":2,"a":1} becomes an object with a before b when key sorting is selected.

Standard JavaScript number precision applies; large integers beyond 2^53 − 1 can lose precision. Keep such identifiers as strings. Files remain local.

Using JSON Formatter with the right inputs

Format, minify and validate JSON with useful errors. Start by matching your task to the quantities and options shown below. The definitions of the inputs matter as much as the final number or transformed output; retain the original values so that you can repeat or check the result.

Inputs and options explained

  • JSON input: paste the source text without omitting meaningful spaces, quotation marks or line breaks. Begin with a small representative sample so that you can check the transformation before processing a longer input.
  • Or choose a JSON file (up to 5 MB): choose a local source file and keep the original. The file selector accepts .json, application/json. Check that the file contents match the intended format; renaming an extension does not convert a file.
  • Action: choose Format · 2 spaces, Format · 4 spaces, Minify, Validate, Sort object keys recursively.

Method and interpretation

The formatter parses JSON into a value and serializes it with the chosen indentation or compact output. Recursive key sorting changes object member order while retaining array order. Validation checks whether the input can be parsed as JSON.

Worked example

For {"b":2,"a":1}, choose recursive key sorting to place a before b. A trailing comma such as {"a":1,} is invalid JSON and should produce a validation error rather than formatted output.

Assumptions and limitations

Parsing and re-serialization can change number spelling, whitespace and duplicate object keys. JavaScript numbers cannot represent every integer beyond 9,007,199,254,740,991 exactly. Store identifiers that require exact digits as strings. A valid JSON document is not necessarily valid for your application's schema.

Does formatting validate my API data model?

No. Parsing checks JSON syntax. Required fields, acceptable values and business rules still need validation against the application's schema or contract.

Before you use the output

  • Choose the intended action: Process JSON. Re-run the operation after changing an input or mode so that you are checking the updated result.
  • Read the result label and any accompanying explanation. Keep the input values or source file with the output so that a later comparison uses the same assumptions.
  • If a result looks unexpected, check units, separators and selected options first. Try a smaller example you can verify rather than repeatedly changing several settings at once.

Reference for further reading

RFC 8259: The JSON data interchange format. This reference explains the underlying topic; it does not certify this tool.

Questions or a result that needs checking?

If you find a discrepancy, report a problem with JSON Formatter. Include a non-sensitive example, the selected options, the result you expected and the result shown. This makes the issue easier to reproduce. See About & privacy for how the site handles tool inputs.

A few useful next steps.

More developer tools →