“#JSON5 is an extension to the popular #JSON file format that aims to be easier to write and maintain by hand (e.g. for config files). It is not intended to be used for machine-to-machine #communication.”

Against advice, a naive #programmer may be tempted to avoid using quotes for properties of objects in JSON payloads, and save on #bandwidth! Sure, why not? Every little (byte) helps. But we should not be embedding #Base64 encoded #binary files in those JSON payloads !!!

To be clear, this little monkey photo is about 312KB. Base64 encoded (#ASCII representation) is about 416KB. According to #MDN, about 133% increase is normal. Also, we usually use #UTF8 encoding. That means doubling the byte size: about 832KB (266%) because minimum character size in UTF8 is 2 bytes. A small text message of a few KBs unnecessarily becomes almost 1MB beast. Files should be sent to a file service (another big topic).

Simple things matter when your systems should handle millions of messages.

Next time I shall talk about possible data loss on poorly designed/managed JSON columns in tables in #SQL #databases – just to mimic naively #document/ #NoSQL databases.

Happy #coding!

https://www.npmjs.com/package/json5