3 ms·
My favorite serde format is Msgpack since it can be dropped in for an almost one-to-one replacement of JSON. There's also CBOR which is based on MsgPack but has
by elcritch 2y ago
My favorite serde format is Msgpack since it can be dropped in for an almost one-to-one replacement of JSON. There's also CBOR which is based on MsgPack but has diverged a bit and added and a data definition language too (CDDL).
Take JSON-RPC and replace JSON with MsgPack for better handling of integer and float types. MsgPack/CBOR are easy to parse in place directly into stack objects too. It's super fast even on embedded. I've been shipping it for years in embedded projects using a Nim implementation for ESP32s (1) and later made a non-allocating version (2). It's also generally easy to convert MsgPack/CBOR to JSON for debugging, etc.
There's also an IoT focused RPC based on CBOR that's an IETF standard and a time series format (3). The RPC is used a fair bit in some projects.
1: https://github.com/elcritch/nesper/blob/devel/src/nesper/servers/rpc/rpcsocket_mpack.nim https://github.com/elcritch/nesper/blob/devel/src/nesper/ser...
2: https://github.com/EmbeddedNim/fastrpc https://github.com/EmbeddedNim/fastrpc
3: https://hal.science/hal-03800577v1/file/Towards_a_Standard_Time_Series_Representation_for_IoT_using_CBOR_Templates____Sebastian_Molina-18.pdf https://hal.science/hal-03800577v1/file/Towards_a_Standard_T...