Planet 1 Ltd

Zepto JSON Embedded Tool C Struct Output

Zepto JSON Embedded Encoder/Decoder (serializer/deserializer) has been written specifically for small embedded systems/microcontrollers with limited RAM and Flash/ROM memory space, it has the following features and restrictions:


  • Encodes (serializes) from and Decodes (deserializes) to a (fixed memory size) C data structure (generated by the JSON Embedded Creation tool, see below)
  • Uses a const (Flash/ROM based) table to navigate the data structure (generated by the JSON Embedded Creation tool)
    • uses only 20 bytes (Atmel SAM3S) of Flash per structure item or array definition
  • The JSON Embedded tool generates the const table and data structure from a JSON template file
  • Non-blocking state machine decoder and encoder to enable other tasks to execute in a non-RTOS system
  • Non-recursive
  • Can serialize (process) as little as 1 character at a time for both encode and decode
  • Can ignore unexpected JSON that is not defined in the template (compile time switch to disable)
  • Handles null values
  • Converts number types to types specified by the JSON template and defined in the C structure
  • Full embedded C source code
  • Inexpensive, per product royality free licence


To enable a compact fixed sized memory footprint, a few restrictions are required (which are the norm anyway):

  • All values within a JSON array must be of the same type
  • Strings are ASCII UTF-8 only. Note: "\uYYXX" is supported for the lower 8 bits (XX), the upper 8-bits YY are ignored for decode and are set to 00 for encode.

JSON Embedded Creation Tool

This pre-compile or compile time tool uses sample JSON as a template to build and output the JSON Embedded C header file which contains the C structure and const (Flash/ROM) table for including in a C file.
The tool has additional notation to changes name strings, array maximum sizes and C types.

This compile-time method to create the run-time Zepto JSON C structure and encode/decode Flash LUT is unique and produces extremely low RAM and Flash usage compared to other JSON implementations, it is non-recursive and non-blocking - ideal for tightly coded, reliable real-time systems.