Base URL: https://api.jsonfmt.dev
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
}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
/formatPretty-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)/minifyRemove 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)/validateCheck 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())/repairFix 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())/diffCompare 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())/convert/:formatConvert JSON to 32 different output formats. Replace :format in the URL with any format from the table below.
| Format | Path | Output | Status |
|---|---|---|---|
| Data Formats | |||
| YAML | /convert/yaml | YAML config | Live |
| CSV | /convert/csv | Comma-separated values | Live |
| XML | /convert/xml | XML document | Live |
| TOML | /convert/toml | TOML config | Live |
| Markdown | /convert/markdown | Markdown table | Live |
| .env | /convert/dotenv | Dotenv format | Live |
| Base64 Encode | /convert/base64 | Base64 string | Live |
| Base64 Decode | /convert/base64decode | Decoded JSON | Live |
| Code Generators | |||
| TypeScript | /convert/typescript | TS interface | Live |
| Python | /convert/python | Python dataclass | Live |
| Go | /convert/go | Go struct | Live |
| Rust | /convert/rust | Rust struct (serde) | Live |
| Java | /convert/java | Java POJO | Live |
| C# | /convert/csharp | C# class | Live |
| Kotlin | /convert/kotlin | Kotlin data class | Live |
| Swift | /convert/swift | Swift Codable struct | Live |
| Dart | /convert/dart | Dart class | Live |
| PHP | /convert/php | PHP array | Live |
| Ruby | /convert/ruby | Ruby hash | Live |
| Schema & Validation | |||
| Zod | /convert/zod | Zod schema | Live |
| PropTypes | /convert/proptypes | React PropTypes | Live |
| Mongoose | /convert/mongoose | Mongoose schema | Live |
| GraphQL | /convert/graphql | GraphQL SDL | Live |
| OpenAPI | /convert/openapi | OpenAPI 3.0 schema | Live |
| Protobuf | /convert/protobuf | Protobuf schema | Live |
| JSON Schema | /convert/jsonschema | Draft-07 schema | Live |
| Mermaid | /convert/mermaid | Mermaid diagram | Live |
| Database | |||
| SQL Insert | /convert/sql | SQL INSERT statements | Live |
| SQL DDL | /convert/sqlddl | CREATE TABLE | Live |
| MongoDB | /convert/mongodb | MongoDB insert | Live |
| Transform | |||
| Flatten | /convert/flatten | Dot-notation keys | Live |
| Unflatten | /convert/unflatten | Nested JSON | Live |
| CSV → JSON | /convert/csv2json | JSON array | Live |
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)/healthHealth 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" }JSON transformation and analysis endpoints. All accept POST with JSON body.
| Endpoint | Description | Body Format |
|---|---|---|
/compact | Smart compact formatting | Raw JSON |
/sort-keys | Sort object keys alphabetically | Raw JSON |
/escape | JSON-escape a string | Raw string |
/unescape | Unescape a JSON string | JSON string |
/redact | Redact sensitive values (passwords, tokens, keys) | Raw JSON |
/pick | Keep only specified keys | {"input":{...}, "keys":["a","b"]} |
/omit | Remove specified keys | {"input":{...}, "keys":["a","b"]} |
/merge | Deep merge two objects | {"a":{...}, "b":{...}} |
/groupby | Group array by field | {"input":[...], "key":"field"} |
/sortby | Sort array by field (prefix - for desc) | {"input":[...], "key":"-age"} |
/size | Size report with top keys breakdown | Raw JSON |
/security | Scan for secrets, tokens, keys, IPs | Raw JSON |
/stats | Count objects, arrays, keys, types, depth | Raw JSON |
/profile | Data profiling (types, ranges, nulls per path) | Raw JSON |
/mock | Generate realistic mock data from template | Raw JSON |
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]"
}| Endpoint | Description | Body Format |
|---|---|---|
/jwt/decode | Decode JWT token (header + payload) | Raw JWT string |
/schema/validate | Validate JSON against Draft-07 schema | {"data":{...}, "schema":{...}} |
/schema/generate | Generate JSON Schema from sample | Raw JSON |
/jsonpath | JSONPath query (wildcards, filters, slices) | {"input":{...}, "path":"$.x"} |
/jsonl/validate | Validate JSONL (one JSON per line) | Raw JSONL text |
/jsonl/to-array | Convert JSONL to JSON array | Raw JSONL text |
/jsonl/from-array | Convert JSON array to JSONL | Raw JSON array |
/patch | Generate RFC 6902 JSON Patch | {"a":{...}, "b":{...}} |
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"] }All errors return JSON with an "error" field.
{ "error": "description of what went wrong" }| Code | Meaning | How to Fix |
|---|---|---|
400 | Bad Request | Check your JSON syntax or request body |
401 | Unauthorized | Verify your API key is valid |
405 | Method Not Allowed | Use POST for processing endpoints, GET for /health |
429 | Rate Limited | Wait 60s or get an API key for higher limits |
500 | Server Error | Retry or contact support |
Rate limits are enforced per IP (anonymous) or per key (authenticated). Every response includes rate limit headers.
| Tier | Rate Limit | Monthly Quota | Cost |
|---|---|---|---|
| Anonymous | 10 req/min | Unlimited | Free |
| Free (with key) | 100 req/min | 1,000 requests | Free |
| Pro (with key) | 1,000 req/min | 50,000 requests | $9/mo |
Get a free API key in 3 steps. We will send a 6-digit verification code to your email.
We sent a 6-digit code to
Code expires in 10 minutes.
Paste your API key to check your tier, rate limits, and make a test request.