ForHosting KIT · Data & Files

Format JSON

Minified or inconsistently indented JSON is unreadable in a code review and unstable in version control, since two semantically identical objects can produce wildly different diffs. This JSON formatter API rewrites any payload with consistent indentation and, optionally, deterministic key ordering, so the same data always renders the same way.

● StableFree · in your browser
Use it from WebAPIEmailApp soonTelegram soon

Runs in your browser. Free, unlimited — your data never leaves this page.

Why unformatted JSON causes real problems

A JSON file saved by one tool, edited by a script, and committed by a third person tends to accumulate inconsistent spacing, mixed tab and space indentation, and keys in whatever order the last serializer happened to emit them. None of that breaks parsing, but it wrecks code review: a one-line change can show up as a hundred-line diff because a key moved position or the whole object got re-indented. Teams that store configuration, fixtures, or API snapshots as JSON feel this pain constantly.

What the endpoint actually does

You call POST /data/json-format with a JSON body and get a task_id back immediately, since formatting runs as an asynchronous job. The service parses the payload, re-serializes it with consistent, configurable indentation, and — when you request it — sorts object keys alphabetically at every nesting level, so the byte-for-byte output is identical every time the same logical data goes in. Arrays keep their original order, since array order is usually semantically meaningful, while only object keys are subject to stable sorting.

Stable ordering and why it matters

The JSON specification never mandated a key order, which is technically correct but practically inconvenient: two libraries can serialize the exact same object with keys in a different sequence, and a naive text diff will flag that as a change even though nothing meaningful moved. Stable key ordering removes that ambiguity entirely, turning JSON into something that behaves like a normalized, comparable artifact rather than an unordered bag of properties that happens to look different every run.

Where it fits an automated pipeline

Drop this step wherever JSON crosses a boundary that a human will eventually read: before committing generated configuration to a repository, before storing API response fixtures for tests, or right before writing a payload into a log or an audit trail. It pairs naturally with the minifier for the opposite need — format for humans during development, minify again before shipping to production — using the same underlying data with two different presentations.

Delivery, pricing, and status

The formatted JSON is delivered by a signed webhook, recommended for automated pipelines, or a signed link valid for 24 hours; source and output are deleted after the retention window and never used for training. Pricing is a flat $0.002 per request regardless of payload size, and a failed task — for instance, invalid JSON that cannot be parsed — is never charged after the standard three retries. This endpoint is live now.

Clean diffs on generated configuration

Run auto-generated JSON config through the formatter with stable key ordering before committing it, so pull requests show only the lines that actually changed.

Normalize API fixtures for testing

Format captured API responses consistently so test fixtures stay comparable across recordings taken from different client libraries or SDK versions.

Prepare payloads for human review

Pretty-print a compact webhook payload before displaying it in an internal dashboard or support ticket, turning a dense single line into something a teammate can actually read.

Standardize exported data snapshots

Format nightly JSON exports with the same indentation and key order every time, making it trivial to spot what actually changed between two dates.

How do I format JSON with an API?

Send your JSON body to POST /data/json-format, which returns a task_id right away; the pretty-printed result arrives at your signed webhook or a signed link once the job finishes.

Is the JSON formatter API free?

The tool above runs free in your browser. The API is paid — each call draws from your prepaid ForHosting KIT balance: top up from $10.00 (it never expires), pay each request's published price, and a call with no balance returns HTTP 402. No subscription, no tokens, and a failed task is never charged.

What does stable key ordering mean here?

Object keys are sorted alphabetically at every nesting level so the same logical data always produces byte-identical output, which keeps version-control diffs meaningful. Array element order is preserved as-is.

Does formatting change my data or types?

No. Only whitespace, indentation, and optionally key order change; string, number, boolean, and null values are preserved exactly as parsed.

Can I format very large JSON files?

Yes, within the size limits published for the endpoint; because pricing is a flat fee per request, cost stays predictable regardless of how large a valid payload is.

What happens if the input isn't valid JSON?

The task fails with a clear parsing error after the standard three retries, and you are not charged for it.

Can I format JSON in bulk?

Yes. Each request is an independent asynchronous task, so you can submit large batches in parallel and collect each result by webhook as it completes.

How is this different from the JSON minifier?

The formatter expands JSON for readability with indentation and stable key order; the minifier does the opposite, stripping whitespace for the smallest possible payload.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/data/json-format

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/data/json-format \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"…"}'
{
  "input": "…"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "data.json_format",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →