Our great sponsors
-
tiny-json
The tiny-json is a versatile and easy to use json parser in C suitable for embedded systems. It is fast, robust and portable.
-
jemi
jemi: a compact, trusting, JSON serializer with static allocation in pure C for embedded systems
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
JSMN
Jsmn is a world fastest JSON parser/tokenizer. This is the official repo replacing the old one at Bitbucket
-
zcbor
Low footprint C/C++ CBOR library and Python tool providing code generation from CDDL descriptions.
FYI I've been using https://github.com/rafagafe/tiny-json for several years now.
So I created jemi ("Json EMItter"): you use use jemi primitives to build up the JSON structure that you need, then call jemi_emit() to dump the resulting JSON string to the output of your choice.
Context: I needed to emit rather complex compound JSON data for a C-based project I'm working on. I could do it all with sprintf(), but it got messy quickly. I looked at available libraries such as jansson and CCAN's json, but they both used malloc(), which isn't an option in my case.
I use his serializer too: https://github.com/rafagafe/json-maker/tree/master/src
Another option that may work for some is SerDe on rust. You just write a struct with the fields you want #[derive(Serialize, Deserialize)] above it, and if codegens the functions to deserialize that struct from JSON and serialize it back. Example looks like this https://docs.rs/serde_json/latest/serde_json/#creating-json-by-serializing-data-structures (but you have to use serde-json-core if you don’t have an allocator). Can also easily reserialize to something small like postcard that’s meant for embedded storage.
This is quite similar to cJSON, although cJSON leans more towards dynamic memory allocation.
Check out tinyCBOR and NanoCBOR
Check out tinyCBOR and NanoCBOR
As mentioned here, it appears that tiny-json is a parser, not a serializer. If you're looking for parsers, I've been very happy with jsmn.
Tinycbor is quite messy since you need one var for each map, element and level, for no reason. I ported all my cbor code to zcbor which is a lot cleaner.