JSONParse Open the viewer

Docs

HTTP API reference

The same engine the viewer runs locally, exposed over HTTP so build scripts, CI jobs and agents can call it. No key, no account, rate limited by IP.

Read the privacy page before sending anything sensitive. The browser viewer never transmits your document; the API receives it by definition.

Endpoints

Method and pathPurpose
POST /api/formatBeautify or minify a document.
POST /api/validateCheck syntax and report the first error with line and column.
POST /api/diffCompare two documents structurally and return a patch, a report or counts.
POST /api/to-typescriptGenerate TypeScript interfaces or type aliases.
POST /api/schemaGenerate a JSON Schema (draft 2020-12 or draft-07).
POST /api/mockGenerate a document from a template. Here json is the template, not a document.

Request

/api/diff is the one endpoint that takes two documents: send left and right as strings instead of json, both counting towards the same 4 MB body limit.

/api/mock is the one endpoint whose json property is not a document to work on but a template to generate from — see the generator for the tag syntax. It answers with the generated document as text, plus a meta.seed naming the seed it used, so the same document can be produced again by sending that seed back.

Send Content-Type: application/json with a json property holding the document as a string. Sending it as a string rather than a parsed value is deliberate: it preserves key order, number formatting and whitespace, and it lets /api/validate report on documents that are not valid JSON at all.

curl -sS https://jsonparse.online/api/to-typescript \
  -H 'content-type: application/json' \
  -d '{
        "json": "[{\"id\":1,\"name\":\"Ada\"}]",
        "options": { "rootName": "User", "style": "interface" }
      }'

Response

{
  "ok": true,
  "result": "export interface UserItem {\n  id: number\n  name: string\n}\n\nexport type User = UserItem[]\n",
  "stats": { "bytes": 27, "nodes": 5, "ms": 1 }
}

Every endpoint returns { "ok": true, ... } or { "ok": false, "error": { "code", "message", ... } }. A document that will not parse is an invalid_json error with line, column, offset and a source snippet — except on /api/validate, where a malformed document is the expected answer rather than a failure: that endpoint returns HTTP 200 and { "ok": true, "result": { "valid": false, "error": { ... } } }.

Options

EndpointOptions
/api/formatmode: beautify (default) or minify. indent: number of spaces, or "\t".
/api/validateNone.
/api/diffTakes left and right instead of json. output: patch (default), report or summary. arrayStrategy: aligned (default), positional or unordered. identityKeys, ignoreCase, trimStrings, collapseWhitespace, epsilon, detectMoves, leftName, rightName, limit.
/api/to-typescriptrootName, style, exported, readonly, optionalMarker, literalUnions, indent, enumLimit.
/api/schematitle, draft, closed, required, inferIntegers, detectFormats, detectEnums, constraints, enumLimit.
/api/mockformat: pretty (default), minified or ndjson. seed: any text, for a reproducible document. count: overrides the outermost {{repeat()}}. targetBytes: keep repeating until the output reaches this size. indent.

Limits and errors

StatusCodeMeaning
400invalid_requestMalformed envelope, missing json, or an option out of range.
400invalid_jsonThe document does not parse. Carries line, column, offset and snippet.
405method_not_allowedOnly POST and OPTIONS are accepted.
413payload_too_largeBody exceeded 4 MB. Use the viewer for anything larger.
415unsupported_media_typeContent-Type was not application/json.
429rate_limitedToo many requests from this address. Honour Retry-After.
500internal_errorUnexpected failure; the response carries a request id.

CORS is open for POST and OPTIONS, so the endpoints can be called from a browser. Rate limiting is per instance and per address, and is a courtesy guard rather than a quota: for heavy or continuous use, work in the viewer instead, where the parsing happens on your own machine and nothing is rate limited at all.

Frequently asked questions

Is there an API key?

No. The endpoints are open and rate limited by address. There is nothing to sign up for and nothing to revoke.

Why does the document have to be a string?

Because re-serialising it would destroy exactly the things these endpoints are asked about: key order, number text, whitespace, and in the validator case the syntax error itself.

What is the largest document the API accepts?

4 MB. The viewer handles documents orders of magnitude larger, because it never has to move them across a network.

Last updated .