3 ms·
You have two types of situations for JSON. Static and dynamic. For static JSON, you have a flat file and that's that. It's always the same. In this case, all t
by maratd 15y ago
You have two types of situations for JSON. Static and dynamic.
For static JSON, you have a flat file and that's that. It's always the same. In this case, all these fancy optimization formats are pointless. GZip the hell out of it once, cache it, and simply serve the compressed version. Binary compressed data is always optimal. The browser will automatically decompress and utilize. CPU is plentiful on the client-side. Debugging is easy, Firebug will display the clean JSON.
For dynamic JSON, you have a problem. You can't optimize or compress. Remember, it's all about total time. It doesn't matter if your data is now smaller if the amount of time it took to make it smaller is larger than the amount of time it would have taken to download the difference between the original data and the optimized data.