There are no special data structures or algorithms. Limited data transfer is sufficient.
Example data (in the form of a string C, pay attention to "\\", which is actually "\"): key1;value1;key2;value2;key3\\;with delimiter inside it;value3;\0
You can choose which keys you send, it is easy to read * and write **, it takes up a bit of memory and can even be compressed (since this is just one stream of bytes).
* - Reading:
while( peekbyte() != 0 ) { key = readuntil( ';' ); // checks if previous byte isn't "\" while looking for char. value = readuntil( ';' ); add( key, value ); }
** - Record:
foreach( key in keylist ) { write( replace( ';', '\\;', key ) ); write( replace( ';', '\\;', dict[ key ] ) ); } write( '\0' );
source share