All tools

Compress JSON

AI / Agent

Remove nulls, empty arrays, empty objects from JSON to reduce token footprint before sending to an LLM.

An API response headed into an LLM prompt often carries nulls and empty arrays or objects that add tokens without adding information, and this strips exactly those (actual `null` values, `[]`, and `{}`) while leaving falsy-but-meaningful values like `0`, `false`, and empty strings alone, since removing those would change the data's actual meaning. It also minifies whitespace as part of the same pass. This is a one-way transformation meant for data headed to an LLM specifically: if your own application code checks for the presence of a key (even a null one), stripping that key changes behavior, so don't run production payloads your own parser will read through this tool. Everything runs in your browser with nothing uploaded.

jsoncompresstokensnullscleanagent

How to use Compress JSON

  • 1.Paste a JSON payload with lots of null fields and empty arrays/objects to strip them out before including it in an LLM prompt.
  • 2.Use it on an API response before logging it or storing it in a context window, since nulls and empty containers add tokens without adding information.
  • 3.Compare output size against the original to decide whether it's worth compressing a given payload before an LLM call.

Frequently asked questions

Does removing nulls change how my application reads the JSON?
It can — if your code checks for the presence of a key (even if null), removing that key changes behavior, so only use this on data headed to an LLM prompt, not on payloads your own code will parse.
Does it also minify (remove whitespace)?
Yes, the output is compact JSON with whitespace removed in addition to nulls/empty values stripped.
Is my JSON sent to a server?
No, this runs entirely in your browser.
What counts as "empty" — does 0 or false get removed?
No, only actual nulls, empty arrays ([]), and empty objects ({}) are stripped; falsy-but-meaningful values like 0, false, and empty strings are preserved since removing them would change the data's meaning.

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/compress-json \
  -H "Authorization: Bearer utx_live_..." \
  -H "Content-Type: application/json" \
  -d '{"json":{"user":{"firstName":"Alice","lastName":null,"tags":[]}},"removeNulls":true,"removeEmptyArrays":true,"removeEmptyObjects":true,"sortKeys":false}'

Get an API key from your dashboard · Full API docs →