Do not fall into the NIH trap but keep standing on the shoulders of giants! Several message serialization protocols exist.
Several implementations of such protocols exist (even for Arduino).
I suggest to have a look in a search engine for such protocols and add Arduino.
I've found:
- ardubson (BSON)
- msgpack-mcu (MessagePack)
- nanopb (Protocol Buffers)
PS: You might read https://scottlocklin.wordpress.com/2017/04/02/please-stop-writing-new-serialization-protocols/ Just choose a giant compatible with your requirements ;-)