2 ms·
You're describing the type-length-value format, used in some places in digital video or in Open Sound Control. Basically you have a TYPE (fixed width, eg. 16 b
by athenot 10y ago
You're describing the type-length-value format, used in some places in digital video or in Open Sound Control.
Basically you have a TYPE (fixed width, eg. 16 bits), a LENGTH (again fixed) and a VALUE which is simply a stream of bytes that goes on for LENGTH bytes and is interpreted based on what TYPE it is. You can nest your fields and get very creative in quite a compact way.
One could represent a JSON document with TLV by adding an associative map between the field names and their type numbers, then stream away.
I always loved the simplicity of TLV. Though nowadays, I'm not sure this has much of an advantage over gzipped JSON.
- ubertaco 10y agoOff-topic: Howdy, Mr. Thénot! Crazy reading the comments and seeing your username here. Hope life is goin' well for ya with the HealthNinja stuff -- haven't seen you since I left Wellcentive (around the same time as mbonnette, if that gives you an idea of who I am).