6º. From JSON to compact: reducing API payloads 60% for LLM consumption
Every time your AI agent calls your API, it pays for the response in tokens. Not just the useful data — every "id":, every "created_at":, every null field it didn't ask for. JSON is designed for hu...

Source: DEV Community
Every time your AI agent calls your API, it pays for the response in tokens. Not just the useful data — every "id":, every "created_at":, every null field it didn't ask for. JSON is designed for humans reading documentation, not for LLMs processing structured data. We measured our API responses before optimization. A typical "show me my events today" call returned 3 events in ~1,200 tokens. After compact format: ~280 tokens. Same information, 77% fewer tokens. This post is about how we built that format, what we tried and killed, and the surprising insight that changed how we think about API design for agents. The problem: JSON is expensive Here's what a standard events response looks like: { "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "title": "Standup", "description": null, "location": "Discord", "start_at": "2026-02-18T09:00:00Z", "end_at": "2026-02-18T09:30:00Z", "all_day": false, "recurrence": {"freq": "weekly", "days": ["mon","wed","fri"]}, "status": "confirmed", "s