[ advertisement ]

JSON Formatter, Validator and Minifier

Paste JSON to pretty-print it with readable indentation, validate the syntax with the exact error position, minify it for production or explore the structure as a tree.

Input

Output

Use via API

Validates and formats (or minifies) a JSON document.

POSThttps://enhanced.dev.br/api/v1/json/format
JSON body parameters
Body (JSON)TypeDescription
json *stringJSON document as text.
indent0 | 2 | 4 | "tab"Indentation; 0 minifies. Default: 2.

Request example

curl -X POST "https://enhanced.dev.br/api/v1/json/format" \
    -H "Content-Type: application/json" \
    -d '{"json":"{\"name\":\"NT Tools\",\"tags\":[\"json\",\"api\"]}","indent":2}'

Response

{
  "ok": true,
  "data": {
    "output": "{\n  \"name\": \"NT Tools\",\n  \"tags\": [\n    \"json\",\n    \"api\"\n  ]\n}",
    "valid": true
  },
  "meta": {
    "version": "v1"
  }
}
  • Errors return { ok: false, error: { code, message } } with an HTTP 4xx/5xx status.
  • Free, no API key required. Limited to 120 requests per minute per IP.
  • CORS enabled: call it straight from the browser on any domain.
[ advertisement ]

How to use

  1. Paste or type JSON into the input panel.
  2. Pick an indentation (2 spaces, 4 spaces or tab) and click Format.
  3. If there is a syntax error, the message shows the line and column of the problem.
  4. Use Minify to strip all whitespace and line breaks.
  5. Switch to Tree view to expand and collapse objects and arrays.
  6. Copy the result or download it as a .json file.

Use cases

  • Inspecting REST API and webhook responses during development.
  • Finding trailing commas, single quotes or unclosed braces in config files.
  • Minifying payloads before embedding them in environment variables or requests.
  • Exploring large NoSQL documents by browsing the tree.

Technical concepts

What makes JSON valid

RFC 8259 requires double-quoted keys and strings, no trailing comma after the last item and no comments. Allowed values are object, array, string, number, true, false and null. Habits carried over from JavaScript, such as single quotes, unquoted keys and undefined, make a document invalid.

Formatting versus minifying

Formatting adds line breaks and indentation for humans without changing the data. Minifying removes every insignificant whitespace character to shrink transfers. Both run a full parse and serialization, so they also validate the document.

Number precision

The browser's native parser stores numbers as 64-bit IEEE 754 floats. Integers above 2^53 − 1 (9,007,199,254,740,991) lose precision when reformatted; very large IDs should travel as strings.

Frequently asked questions

Is my JSON sent to a server?

No. Parsing and formatting use the browser's own JSON.parse and JSON.stringify. No data leaves your machine.

Why is my JSON with comments invalid?

The JSON standard does not allow comments. Formats such as JSONC or JSON5 do, but they must be converted before a strict JSON parser can read them.

What is the maximum size?

The limit is your browser's memory. Multi-megabyte files format fine; the tree view only opens the first two levels to keep the interface responsive.

Does formatting change the key order?

No. Insertion order is preserved, except for integer-like keys, which JavaScript sorts in ascending order by specification.

Related tools