Question

Concerning modern web applications and browsers. When sending from server to client (and vice versa) large objects (1-10MB raw text JSON size), does it make sense to shorten property name from:

people: {
  name: 'Alex'
  age: '999'
}

for example to:

p: {
  n: 'Alex'
  a: '999'
}

if we have huge number of such objects in the data?

Thus we can significantly reduce raw data size (up to 2-3 times). But does it make sense if GZip is used?

Was it helpful?

Solution

It makes some sense, depending on your circumstances.

Obviously, if the value is quite large, there's not much point in shortening the key, but if you have very large JSON objects with relatively small values then shorter keys can save both storage on your system and transmission time.

But you do, of course, need to beware of "obfuscating" the JSON unnecessarily, leading to coding errors. In particular, it's probably best to use meaningful keys during development, then shorten them, if deemed necessary, prior to "ship".

In addition, if gzip (or similar) compression is used the shorter keys will make almost no difference in the size of the compressed object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top