cesanta/frozen
FreeJSON parser and generator for C/C++ with scanf/printf like interface. Targeting embedded systems.
FreeFree tier
About cesanta/frozen
Frozen is a JSON parser and generator for C/C++ with a scanf/printf-like interface, specifically targeting embedded systems. It is ISO C and ISO C++ compliant, has a very small footprint, and no dependencies. Key features include json_scanf() for scanning JSON directly into C/C++ variables, json_printf() for printing variables into an output stream, json_setf() for modifying existing JSON strings, and built-in base64 encoding/decoding. The parser offers both a low-level callback API and a high-level scanf-like API, with 100% test coverage. Frozen is used in production as part of Mongoose OS for commercial IoT products.
Key Features
ISO C and ISO C++ compliant portable code
Very small footprint and no dependencies
json_scanf() scans JSON directly into C/C++ variables
json_printf() prints C/C++ variables into an output stream
json_setf() modifies an existing JSON string
json_fread() / json_fprintf() read/write JSON from/to files
Built-in base64 encoder and decoder for binary data
Parser provides low-level callback API and high-level scanf-like API
100% test coverage
Used in Mongoose OS for commercial IoT products
Pros & Cons
Pros
- Extremely small footprint and no runtime dependencies
- Portable across all ISO C/C++ compilers and platforms
- Intuitive scanf/printf style interface reduces boilerplate code
- Low memory usage suitable for embedded systems
- Proven in production via Mongoose OS
- 100% test coverage ensures reliability
Cons
- Limited to C/C++; not directly usable from other languages
- Custom format specifiers (%B, %Q, %V, etc.) have a learning curve
- No built-in support for validating JSON schema or typing
- Primarily designed for embedded use; may lack features needed for complex enterprise JSON processing
Best For
Parsing JSON configuration files in embedded C/C++ applicationsGenerating JSON output from C/C++ data structures on microcontrollersModifying existing JSON strings in-place for small memory systemsSerializing/deserializing data for IoT devices and sensor networksHandling JSON-based protocols in resource-constrained environments
FAQ
What is Frozen?
Frozen is a JSON parser and generator for C/C++ with a scanf/printf-like interface, designed for embedded systems.
Does Frozen have any dependencies?
No, it has no external dependencies and is self-contained.
What platforms does Frozen support?
It is ISO C and ISO C++ compliant, making it portable across virtually any platform with a C/C++ compiler.
How do I parse JSON with Frozen?
Use the json_scanf() function, which accepts a scanf-style format string to extract values into C/C++ variables.
Can Frozen generate JSON?
Yes, use json_printf() to output C/C++ variables as JSON strings, or json_fprintf() to write to a file.
Does Frozen support binary data?
Yes, it includes built-in base64 encoding and decoding for binary data, accessible via %V format specifier.