How many tokens does JSON use?
JSON usually costs more tokens than the same facts in plain text. Every brace, quote and comma has to be encoded, and key names repeat for every record. In an array of 500 orders, the word customer_email is sent 500 times.
A tree view makes this visible. Paste the payload, sort by share, and look at the two or three branches at the top.
Does minifying JSON reduce tokens?
Yes, in most cases. Removing indentation and line breaks takes out whitespace tokens, and the model reads the data just as well. The counter shows both versions so you can see the saving on your own payload.
Five ways to shrink a JSON payload
- Minify it before sending.
- Remove nulls, empty arrays and fields the model doesn't need.
- Shorten long key names that repeat in every record.
- Round numbers and shorten timestamps.
- Send flat tables as CSV with one header row.
Take the second step first. Dropping unused fields is safe and often saves the most. Shortening keys can make data harder for the model to interpret, so check the answers afterwards.
JSON, CSV or TOON for LLM input?
| Format | Good for | Watch out for |
|---|---|---|
| JSON | Nested data and model output | Repeated keys in long arrays |
| CSV | Flat tables | No nesting |
| TOON | Uniform arrays in prompts | Newer format that some tools don't parse |
Measure your own data before you switch. For plain text, use the AI token counter. To see what the saving is worth each month, use the LLM cost calculator.