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/to-typescriptGenerate TypeScript interfaces or type aliases.
POST /api/schemaGenerate a JSON Schema (draft 2020-12 or draft-07).

Request

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/to-typescriptrootName, style, exported, readonly, optionalMarker, literalUnions, indent, enumLimit.
/api/schematitle, draft, closed, required, inferIntegers, detectFormats, detectEnums, constraints, enumLimit.

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, self-host from the repository.

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 .