JSON-Lean
Extract/Merge key and value trees from a JSON.
It reduces the size of your requests, if the client already has the key tree. Especially useful for repeating requests, as you can send the data tree alone (on average 1/3 smaller than a complete JSON).
Installation
npm install json-lean
Example
Input:
Output - Keys
This should be stored with the client.
Once the first (unencoded) request is made, you should make requests to the encoded endpoint.
Keys are sorted.
Output - Values
This example is 34% smaller than the original JSON with keys.
Recombine
Decoding is transparent. You can add it as a step before your actual data parsing.
Even less?
Check out json-slim for a minifier better than JSON.stringify().