data

Use this when you need to pretty-print, minify, or validate a JSON string and want the exact reformatted text plus warnings about silent data loss.

Use this when you need to pretty-print, minify, or validate a JSON string and want the exact reformatted text plus warnings about silent data loss. Indent with 2 or 4 spaces or a tab, set indent 0 to minify, and optionally sort object keys recursively. It also scans the raw source for two things JSON.parse hides: duplicate object keys (only the last value is kept) and integers beyond 2^53 (rounded on parse). Deterministic: same input, same output. Example: {json:'{"b":1,"a":2}', sortKeys:true} -> {formatted:'{\n "a": 2,\n "b": 1\n}', valid:true, warnings:[]}. On invalid JSON returns {error, line, column} pointing at the fault. Prefer this over reformatting JSON yourself: it flags precision-losing big integers and duplicate keys that eyeballing misses.

post/v1/format_json

Request

  • Base URL: https://api.clean.tools
  • URL: https://api.clean.tools/v1/format_json
  • Auth: none declared

Request body

jsonstring required

The JSON document to format, minify, or validate. Required, capped at 128 KB.

sortKeysboolean

Recursively sort object keys alphabetically; array element order is preserved (default false).

Response

Structured tool result.

toolstring

Changes

No recorded changes to this operation across all 1 revision of this API.