Service-to-service transfer
For APIs, queues and files, JDogo is the smallest format once compressed, round-trips every value exactly, and needs no schema agreed in advance.
Measured
| Gzipped | JSON | Avro (binary) | JDogo | vs JSON |
|---|---|---|---|---|
| Flat table, 2,000 rows | 37.5 KB | 32.7 KB | 25.4 KB | −32% |
| Time series, 500 points | 2.6 KB | 2.6 KB | 1.1 KB | −59% |
| Kafka message batch | 774 B | 757 B | 385 B | −50% |
| All 200 test cases | 480 KB | 417 KB | 332 KB | −31% |
Exact round trips over all 200 cases: JDogo 200, Avro 161, TOON 192. Avro needs one schema for every row, so data whose shape changes from row to row does not come back exactly.
How
from jdogo import JDogoFastAPIMiddleware app.add_middleware(JDogoFastAPIMiddleware) # Accept: application/jdogo gets JDogo
import { jdogoExpressMiddleware } from "jdogo";
app.use(jdogoExpressMiddleware());<!-- add jdogo-spring-boot-starter; application/x-jdogo is negotiated -->
text = jdogo.dumps(rows) # write rows = jdogo.loads(text) # read, in any of the three languages
Compress as you would JSON (Content-Encoding: gzip or br). Clients that don't send Accept: application/jdogo keep getting JSON, so you can switch one consumer at a time. For very large tables, use the streaming reader and writer.