json-build logo

json-build

Free

A tiny, zero-allocation JSON serializer written in ANSI C. A good fit for development in memory constrained systems.

FreeFree tier
Type
Open Source

About json-build

json-build is a tiny, zero-allocation JSON serializer written in ANSI C, designed for memory-constrained systems. It is compatible with C89, has no dependencies, and does not use dynamic memory allocation by default. The library provides a simple builder API for constructing JSON objects, arrays, strings, numbers, booleans, and null values. It also includes automatic buffer management functions (_auto) that reallocate the buffer when needed. json-build is a single-header, header-only library that can be included with just one file. It is the serialization counterpart to jsmn-find, a tokenizer. Ideal for embedded systems and environments where minimal resource usage is critical.

Key Features

Zero-allocation (no dynamic memory) by default
Compatible with C89 (ANSI C)
No dependencies
Single-header (header-only) library
Automatic buffer management option (_auto functions)
Supports JSON objects, arrays, strings, numbers, booleans, null
Lightweight and minimal footprint

Pros & Cons

Pros
  • Zero dynamic memory allocation (avoids heap fragmentation)
  • Small code footprint suitable for resource-limited devices
  • No external dependencies, easy to integrate
  • C89 compatibility works with legacy compilers
  • Optional automatic buffer management for convenience
Cons
  • Only provides JSON serialization (no parsing built-in; uses a separate tokenizer jsmn-find)
  • Manual buffer management can be error-prone without _auto functions
  • Limited to building JSON; does not support validation or pretty-printing out of the box

Best For

Serializing JSON in embedded systems and microcontrollersGenerating JSON output in memory-constrained environmentsC projects requiring a simple, dependency-free JSON builderFirmware and IoT applications where dynamic allocation is not allowed

FAQ

How do I include json-build in my project?
Download json-build.h and include it. It is a single-header, header-only library.
Does json-build use dynamic memory allocation?
By default, json-build uses zero allocation (no dynamic memory). However, it provides _auto counterpart functions that automatically reallocate the buffer when more space is needed.
Can I use json-build with C++?
Since it is written in ANSI C, it can be used in C++ projects with extern 'C' linkage, but it is designed for C.