Change language

Developers

Format, validate and minify JSON

Indent unreadable JSON, check whether it is valid or shrink it.

Published by SolucionesAhora.com How we verify

Calculator inputs

Operation

Results

Enter your values and press “Calculate” to see the result.

Free, no sign-up! What if you could do this without a calculator? A five-minute game with challenges, lives and points. It clicks even when you cannot be bothered.

In short

What it calculates
Indent unreadable JSON, check whether it is valid or shrink it.
Formula used
Format: line breaks and four-space indentation
Example
The input {"name":"KalCum","active":true} formatted takes four lines and contains three nodes.

JSON formatter and validator

JSON coming from an API arrives on a single line, impossible to read. Formatting reveals its structure; minifying makes it ready to transmit.

Along the way the syntax is validated.

How it works

The text is parsed as JSON. If the syntax is valid it is rebuilt indented or compact depending on the operation chosen, and the nodes of the tree are counted.

Formula

Format: line breaks and four-space indentation

Minify: no unnecessary spaces or breaks

Worked example

The input {"name":"KalCum","active":true} formatted takes four lines and contains three nodes.

Explanation

The commonest errors are always the same

A trailing comma at the end of an array or object, single quotes instead of double, an unquoted key, a comment, or an unclosed value. JSON is deliberately strict: it allows neither comments nor trailing commas, even though JavaScript tolerates them. That rigidity is what lets any language read it unambiguously.

Everything is processed in your browser

The text does not leave your machine: formatting happens locally. Even so, it is good practice never to paste credentials, tokens or personal data into any online tool, because it is not always obvious what each one does.

Formatting versus minifying

Indented, it is readable for a person; without whitespace it takes considerably less space and is what should travel over the network. Many APIs respond minified and it is only formatted for debugging. The content is identical either way.

Numbers have limits

JSON does not distinguish integers from decimals, and very large numbers lose precision when read in JavaScript, which uses double precision floating point. Long identifiers should be transmitted as strings to stop them being silently corrupted.

Frequently asked questions

What errors does it catch?

Any syntax problem: single quotes, trailing commas, unquoted keys or unclosed braces.

Is my JSON sent to the server?

Not in normal use: parsing happens in your browser. The server would only act as a fallback if JavaScript were disabled.

Can I put comments in JSON?

No. The format does not allow them, even though many editors tolerate them. Trailing commas after the last element are not allowed either.

Why does my long identifier change value?

Because JavaScript uses double precision floating point and loses accuracy with very large integers. Transmit them as strings instead.

Need to calculate something else?

These tools are often used alongside this calculator.

Base64

Turn text into Base64 and recover the original text.

URL encode

Turn special characters into the safe form used in web addresses.

Hash

Cryptographic digest of a text in MD5, SHA-1, SHA-256 and CRC32.

Passwords

Random passwords with calculated entropy, generated in your browser.

Colours

Convert between colour formats and check contrast against white.