Three transformations
Say each thing once
Nothing here is clever. It is the same three observations anybody makes staring at a large JSON payload, applied properly and made reversible.
A key catalogue
Every distinct key name is written once, at the top of the document, and replaced throughout by a short token. Keys are ranked by how often they are used, so the busiest key gets a one-character token. A key that appears ten thousand times costs its full name exactly once.
Columnar tables
An array of like-shaped objects becomes a column list and a matrix of rows. The key names leave the rows entirely. This is the single biggest win, and it is why record sets compress far better than deeply nested configuration.
Constant and dictionary columns
A column whose value never changes is lifted out of the rows and stored once. A column drawn from a small set of strings — statuses, regions, currencies — becomes a short list plus a row of small integers.
A string catalogue
Anything else that repeats often enough to pay for itself is written once and referenced. The decision is made by measuring, not guessing: a value only enters the catalogue when the reference costs fewer bytes than the copies would.
Before
[ { "id": 1, "name": "Ada", "role": "admin", "team": "core" }, { "id": 2, "name": "Bob", "role": "admin", "team": "core" }, { "id": 3, "name": "Cy", "role": "user", "team": "core" }, { "id": 4, "name": "Dee", "role": "user", "team": "core" } ]
After
{ "jc": 1, "k": ["id","name","role","team"], "s": ["admin","user"], "d": { // columns, encodings, constants "~t": [0,1,2,3], "~e": [0,0,1,2], "~cv": ["core"], "~r": [[1,"Ada",0],[2,"Bob",0], [3,"Cy",1], [4,"Dee",1]] } }