JSON Minifier

Remove every space, tab and line break that JSON doesn't need, and see how many bytes you save. The data stays exactly the same.

Runs only in your browser.
Valid JSON
Your JSON
Minified
399 B → 324 B19% smaller
{"store":"Northwind Coffee","currency":"EUR","open":true,"products":[{"id":101,"name":"Espresso","price":2.2,"tags":["hot","classic"]},{"id":102,"name":"Flat white","price":3.4,"tags":["hot","milk"]},{"id":103,"name":"Cold brew","price":3.9,"tags":["cold"]}],"hours":{"mon-fri":"07:00-18:00","sat":"08:00-14:00","sun":null}}
399 B · 11 lines

Get a URL for this JSON

Fix the errors first: only valid JSON can be hosted.

How to use it

  1. Paste your JSON on the left, or drop a .json file on it.
  2. The minified JSON appears on the right, with the size before and after.
  3. Copy it or download it. If the JSON is invalid, you'll see the error and where it is.

Examples

How much minifying saves depends on how the JSON was written.

A config file indented with 2 spaces

Indented JSON is mostly spaces and line breaks.

Input · 127 B

{
  "theme": "dark",
  "language": "en",
  "features": {
    "newCheckout": true,
    "betaBanner": false
  },
  "retries": 3
}

Minified · 95 B · 25% smaller

{"theme":"dark","language":"en","features":{"newCheckout":true,"betaBanner":false},"retries":3}

A list of records with 4 spaces

The deeper the nesting, the more there is to remove.

Input · 110 B

[
    {
        "id": 1,
        "city": "Lisbon"
    },
    {
        "id": 2,
        "city": "Oslo"
    }
]

Minified · 49 B · 55% smaller

[{"id":1,"city":"Lisbon"},{"id":2,"city":"Oslo"}]

Need a URL for this JSON?

Host it on JSONhost: your app reads it with a GET request, and you edit it from the website, the API or an AI agent.

Every hosted file is also an API. Read it, or a single value of it, and replace or patch it from your code.

Read the API docs

Read the whole file

curl https://jsonhost.com/json/abc123

Read one value

curl https://jsonhost.com/json/abc123/products/0/price

Change one field (JSON Patch)

curl -X PATCH https://jsonhost.com/json/abc123 \
  -H "Authorization: YOUR_FILE_TOKEN" \
  -d '[{ "op": "replace", "path": "/open", "value": false }]'

Questions

What does minifying JSON do?

It removes the whitespace between values: spaces, tabs and line breaks used for indenting. The result is one line that programs read exactly as before, but that is smaller to store and to send.

Does minifying change my data?

No. Keys, values, their order and every number stay the same; spaces inside text are kept. Only the whitespace JSON ignores is removed.

How much smaller does it get?

Usually 10 to 30% for JSON indented with 2 spaces, more for 4 spaces or tabs and deep nesting. The tool shows the exact saving for your JSON.

Should I minify JSON if my server already uses gzip?

gzip already shrinks whitespace a lot, so the gain over the network is small. Minifying still helps where size is counted before compression: storage limits, request size limits, and devices with little memory, like an Arduino or ESP32.

How do I minify JSON in code?

With jq: jq -c . file.json. In JavaScript: JSON.stringify(JSON.parse(text)), which also rounds numbers too large for JavaScript. In Python: json.dumps(data, separators=(",", ":")).

Does JSONhost count the minified size?

Plans are limited by the size of the file you upload, so minifying a JSON before hosting it lets you fit more data into the same plan.

More JSON tools

All JSON tools

Host your first JSON in the next minute.

Upload a file, get a URL, and go back to building the part of your product that people see.