Calculator

What the JSON Formatter does

JSON Formatter: formats Status, Output and Bytes from JSON Input, Indent and Sort keys. Example: indent 2 spaces, sort keys Keep order and action Format gives status Formatted.

The inputs are JSON Input, Indent, Sort keys and Action; the output is Status, Output and Bytes. Everything recomputes live, which makes it easy to test a few scenarios in a row.

Reading raw machine output is painful; a formatted view makes the structure obvious. The JSON Formatter exists to take that particular chore off your hands.

Nothing is uploaded: useful when the text you are inspecting contains keys or customer records.

The field reference, the method and a worked example using the default inputs follow the tool itself.

What do the JSON Formatter fields mean?

The JSON Formatter uses 4 inputs. The fields arrive populated, which makes it easy to nudge a single figure and watch what moves.

FieldWhat to enterDefault
JSON Input paste or type any amount of text [ { "name": "YoursTools", "tools": 801, "categories": ["developer", "finance", "health"], "active": true }, { "name": "Demo App", "tools": 42, "categories": ["math", "converters"], "active": false } ]
Indent choose from 2 spaces, 3 spaces, 4 spaces or Tab 2 spaces
Sort keys choose from Keep order or A to Z Keep order
Action choose from Format, Validate or Minify Format

How does the JSON Formatter work?

Status, Output and Bytes ← f(JSON Input, Indent, Sort keys, Action)

Each output is derived from the inputs above in a single pass; there is no hidden state carried between runs, so the same inputs always give the same formatted output.

If something is off you are told which field, not given a generic failure.

Worked example

These are the values the JSON Formatter loads by default, and the result it produces from them. The numbers below come straight from the default inputs, so you can verify them against the live tool.

Inputs
JSON Input[ { "name": "YoursTools", "tools": 801, "ca…
Indent2 spaces
Sort keysKeep order
ActionFormat
Result
StatusFormatted
Output[ { "name": "YoursTools", "tools": 801, "categories": [ "developer", "finance"…
Bytes282

Formatting and validating

Formatting reveals structure; validating reveals whether the document is legal JSON at all. This tool does both, and it does them in your browser so a payload containing customer data never leaves your machine.

Pretty-printadd indentation and newlinesfor reading and diffing
Minifystrip all insignificant whitespacefor transport
Validateparse against RFC 8259reports position of the first error

Worth knowing

  • Trailing commas, single quotes and comments are all invalid in strict JSON, and are the three most common causes of a parse failure.
  • Two-space indentation is the common default for files under version control, because line-based diffs stay readable.
  • Whitespace is typically 10 to 20% of a payload, though gzip removes most of that redundancy in transit.

How to use it

  1. Paste your content into JSON Input.
  2. Pick a value for Indent: the options are 2 spaces, 3 spaces, 4 spaces or Tab.
  3. Pick a value for Sort keys: the options are Keep order or A to Z.
  4. Pick a value for Action: the options are Format, Validate or Minify.
  5. There is nothing to click. The answer keeps pace with your edits.
  6. Read Status, Output and Bytes in the results panel.
  7. To keep the result, either copy the link or print the page. Both preserve what is on screen.

What this tool does not do

  • Processing happens in your browser, so very large inputs are bounded by available memory.
  • Output follows the common convention for this format; a specific toolchain may have its own house style.
  • The tool answers exactly the question it is given; it cannot know the context around your numbers.

Frequently asked questions

JSON Input, Indent, Sort keys and Action, nothing else. Defaults are loaded for all of them, so you can change one value at a time and watch how the result responds.

With the values loaded when the page opens, status comes out as Formatted. Try changing one value. The answer refreshes without a page reload.

No. There is no upload step, no database, and nothing to delete afterwards.

It is free with no conditions: no sign-up, and no limit on how often you use it.

The formula is shown above precisely so you do not have to take the accuracy on trust.

YoursTools Team
Product & Engineering

Builds and maintains every calculator on YoursTools.