API Documentation

Base URL: https://api.jsonfmt.dev

Introduction

The jsonfmt.dev API provides endpoints for formatting, minifying, validating, repairing, diffing, and converting JSON. All endpoints accept and return JSON over HTTPS.

Make your first call in 30 seconds -- no API key required:

curl -X POST https://api.jsonfmt.dev/format \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice","age":30}'
const res = await fetch('https://api.jsonfmt.dev/format', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: '{"name":"Alice","age":30}'
});
console.log(await res.text());
import requests

r = requests.post('https://api.jsonfmt.dev/format',
    headers={'Content-Type': 'application/json'},
    json={"name": "Alice", "age": 30})
print(r.text)

Response:

{
  "name": "Alice",
  "age": 30
}

Authentication

The API works without authentication at 10 requests/minute. For higher limits, get a free API key and pass it as a Bearer token:

curl -X POST https://api.jsonfmt.dev/format \
  -H "Authorization: Bearer jfmt_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"a":1}'

Every response includes rate-limit headers:

X-RateLimit-Limit: 10
X-RateLimit-Remaining: 7
X-RateLimit-Reset: 1710500060

POST /format

POST/format

Pretty-print JSON with 2-space indentation. Send any valid JSON as the request body.

curl -X POST https://api.jsonfmt.dev/format \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice","age":30,"active":true}'
const res = await fetch('https://api.jsonfmt.dev/format', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: '{"name":"Alice","age":30,"active":true}'
});
console.log(await res.text());
import requests
r = requests.post('https://api.jsonfmt.dev/format',
    json={"name": "Alice", "age": 30, "active": True})
print(r.text)
Try It

POST /minify

POST/minify

Remove all whitespace from JSON. Returns the most compact representation.

curl -X POST https://api.jsonfmt.dev/minify \
  -H "Content-Type: application/json" \
  -d '{  "a" : 1 ,  "b" : 2  }'
const res = await fetch('https://api.jsonfmt.dev/minify', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: '{  "a" : 1 ,  "b" : 2  }'
});
console.log(await res.text());
import requests
r = requests.post('https://api.jsonfmt.dev/minify',
    data='{  "a" : 1 ,  "b" : 2  }',
    headers={'Content-Type': 'application/json'})
print(r.text)
Try It

POST /validate

POST/validate

Check if input is valid JSON. Returns validity status and byte count, or the parse error message.

curl -X POST https://api.jsonfmt.dev/validate \
  -H "Content-Type: application/json" \
  -d '{"valid": true}'
const res = await fetch('https://api.jsonfmt.dev/validate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: '{"valid": true}'
});
console.log(await res.json());
import requests
r = requests.post('https://api.jsonfmt.dev/validate',
    json={"valid": True})
print(r.json())
Try It

POST /repair

POST/repair

Fix broken JSON. Handles comments, trailing commas, single quotes, unquoted keys, Python literals (True/False/None), and undefined.

curl -X POST https://api.jsonfmt.dev/repair \
  -H "Content-Type: application/json" \
  -d "{name: 'Alice', active: True, tags: [1,2,],}"
const res = await fetch('https://api.jsonfmt.dev/repair', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: "{name: 'Alice', active: True}"
});
console.log(await res.json());
import requests
r = requests.post('https://api.jsonfmt.dev/repair',
    data="{name: 'Alice', active: True}",
    headers={'Content-Type': 'application/json'})
print(r.json())
Try It

POST /diff

POST/diff

Compare two JSON documents. Send an object with "a" and "b" keys. Returns a list of changes (add, remove, replace).

curl -X POST https://api.jsonfmt.dev/diff \
  -H "Content-Type: application/json" \
  -d '{"a":{"name":"Alice","age":28},"b":{"name":"Alice","age":29,"role":"admin"}}'
const res = await fetch('https://api.jsonfmt.dev/diff', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    a: { name: "Alice", age: 28 },
    b: { name: "Alice", age: 29, role: "admin" }
  })
});
console.log(await res.json());
import requests
r = requests.post('https://api.jsonfmt.dev/diff',
    json={"a": {"name": "Alice", "age": 28},
          "b": {"name": "Alice", "age": 29, "role": "admin"}})
print(r.json())
Try It

POST /convert/:format

POST/convert/:format

Convert JSON to 32 different output formats. Replace :format in the URL with any format from the table below.

Available Formats

FormatPathOutputStatus
Data Formats
YAML/convert/yamlYAML configLive
CSV/convert/csvComma-separated valuesLive
XML/convert/xmlXML documentLive
TOML/convert/tomlTOML configLive
Markdown/convert/markdownMarkdown tableLive
.env/convert/dotenvDotenv formatLive
Base64 Encode/convert/base64Base64 stringLive
Base64 Decode/convert/base64decodeDecoded JSONLive
Code Generators
TypeScript/convert/typescriptTS interfaceLive
Python/convert/pythonPython dataclassLive
Go/convert/goGo structLive
Rust/convert/rustRust struct (serde)Live
Java/convert/javaJava POJOLive
C#/convert/csharpC# classLive
Kotlin/convert/kotlinKotlin data classLive
Swift/convert/swiftSwift Codable structLive
Dart/convert/dartDart classLive
PHP/convert/phpPHP arrayLive
Ruby/convert/rubyRuby hashLive
Schema & Validation
Zod/convert/zodZod schemaLive
PropTypes/convert/proptypesReact PropTypesLive
Mongoose/convert/mongooseMongoose schemaLive
GraphQL/convert/graphqlGraphQL SDLLive
OpenAPI/convert/openapiOpenAPI 3.0 schemaLive
Protobuf/convert/protobufProtobuf schemaLive
JSON Schema/convert/jsonschemaDraft-07 schemaLive
Mermaid/convert/mermaidMermaid diagramLive
Database
SQL Insert/convert/sqlSQL INSERT statementsLive
SQL DDL/convert/sqlddlCREATE TABLELive
MongoDB/convert/mongodbMongoDB insertLive
Transform
Flatten/convert/flattenDot-notation keysLive
Unflatten/convert/unflattenNested JSONLive
CSV → JSON/convert/csv2jsonJSON arrayLive

Example Request

curl -X POST https://api.jsonfmt.dev/convert/yaml \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice","skills":["go","rust","python"]}'
const res = await fetch('https://api.jsonfmt.dev/convert/yaml', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: '{"name":"Alice","skills":["go","rust","python"]}'
});
console.log(await res.text());
import requests
r = requests.post('https://api.jsonfmt.dev/convert/yaml',
    json={"name": "Alice", "skills": ["go", "rust", "python"]})
print(r.text)
Try It

GET /health

GET/health

Health check endpoint. Returns current status and ISO timestamp. No authentication required.

curl https://api.jsonfmt.dev/health

Response:

{ "status": "ok", "timestamp": "2026-03-15T12:00:00.000Z" }

Tools

JSON transformation and analysis endpoints. All accept POST with JSON body.

EndpointDescriptionBody Format
/compactSmart compact formattingRaw JSON
/sort-keysSort object keys alphabeticallyRaw JSON
/escapeJSON-escape a stringRaw string
/unescapeUnescape a JSON stringJSON string
/redactRedact sensitive values (passwords, tokens, keys)Raw JSON
/pickKeep only specified keys{"input":{...}, "keys":["a","b"]}
/omitRemove specified keys{"input":{...}, "keys":["a","b"]}
/mergeDeep merge two objects{"a":{...}, "b":{...}}
/groupbyGroup array by field{"input":[...], "key":"field"}
/sortbySort array by field (prefix - for desc){"input":[...], "key":"-age"}
/sizeSize report with top keys breakdownRaw JSON
/securityScan for secrets, tokens, keys, IPsRaw JSON
/statsCount objects, arrays, keys, types, depthRaw JSON
/profileData profiling (types, ranges, nulls per path)Raw JSON
/mockGenerate realistic mock data from templateRaw JSON

Example

curl -X POST https://api.jsonfmt.dev/redact \
  -H "Content-Type: application/json" \
  -d '{"user":"Alice","password":"s3cret","api_key":"abc123"}'

Response:

{
  "user": "Alice",
  "password": "[REDACTED]",
  "api_key": "[REDACTED]"
}

Advanced Endpoints

EndpointDescriptionBody Format
/jwt/decodeDecode JWT token (header + payload)Raw JWT string
/schema/validateValidate JSON against Draft-07 schema{"data":{...}, "schema":{...}}
/schema/generateGenerate JSON Schema from sampleRaw JSON
/jsonpathJSONPath query (wildcards, filters, slices){"input":{...}, "path":"$.x"}
/jsonl/validateValidate JSONL (one JSON per line)Raw JSONL text
/jsonl/to-arrayConvert JSONL to JSON arrayRaw JSONL text
/jsonl/from-arrayConvert JSON array to JSONLRaw JSON array
/patchGenerate RFC 6902 JSON Patch{"a":{...}, "b":{...}}

Example — JSONPath Query

curl -X POST https://api.jsonfmt.dev/jsonpath \
  -H "Content-Type: application/json" \
  -d '{"input":{"store":{"books":[{"title":"A"},{"title":"B"}]}},"path":"$.store.books[*].title"}'

Response:

{ "count": 2, "results": ["A", "B"] }

Error Codes

All errors return JSON with an "error" field.

{ "error": "description of what went wrong" }
CodeMeaningHow to Fix
400Bad RequestCheck your JSON syntax or request body
401UnauthorizedVerify your API key is valid
405Method Not AllowedUse POST for processing endpoints, GET for /health
429Rate LimitedWait 60s or get an API key for higher limits
500Server ErrorRetry or contact support

Rate Limits

Rate limits are enforced per IP (anonymous) or per key (authenticated). Every response includes rate limit headers.

TierRate LimitMonthly QuotaCost
Anonymous10 req/minUnlimitedFree
Free (with key)100 req/min1,000 requestsFree
Pro (with key)1,000 req/min50,000 requests$9/mo

Pricing

Anonymous

$0
No sign-up required
  • 10 requests / minute
  • All endpoints
  • No monthly limit
  • Community support

Free

$0
With API key
  • 100 requests / minute
  • All endpoints
  • 1,000 requests / month
  • Email support

Pro

$9 lifetime
Pay once, Pro forever
  • 1,000 requests / minute
  • All endpoints
  • 50,000 requests / month
  • Priority support

Get Your API Key

Get a free API key in 3 steps. We will send a 6-digit verification code to your email.

1Enter email
2Verify code
3Your key

We sent a 6-digit code to

Code expires in 10 minutes.

Test Your API Key

Paste your API key to check your tier, rate limits, and make a test request.

Your API Key
jsonfmt.dev · support@jsonfmt.dev · GitHub