coreJSON  v3.0.0
Parser library for the ECMA-404 JSON standard
Overview

coreJSON Library

A parser that supports key lookups while also strictly enforcing the ECMA-404 JSON standard. The library is written in C and designed to be compliant with ISO C90 and MISRA C. It has proven safe memory use and no heap allocation, making it suitable for IoT microcontrollers, but also fully portable to other platforms.

Memory Requirements

Memory requirements of the JSON library.

Code size of coreJSON library files (sizes generated with GCC for ARM Cortex-M toolchain)
File No Optimization (asserts enabled) With -O1 Optimization (asserts disabled) With -Os Optimization (asserts disabled)
core_json.c 9.5K 4.7K 3.8K

Design

JSON Library Design

Memory Usage

All functions in the JSON library operate only on the buffers provided and use only local variables on the stack. In order to support static-only usage, we made a trade-off to re-parse as necessary so that we would not need to keep state.

Parsing Strictness

Input validation is necessary for strong security posture. As such, the parser strictly enforces the ECMA-404 JSON standard. Additionally, JSON documents are checked for illegal UTF-8 sequences, and strings have unicode hex escapes validated.

Compliance & Coverage

The JSON library is designed to be compliant with ISO C90 and MISRA C:2012. All functions are written to have minimal complexity. Unit tests and CBMC proofs are written to cover every path of execution and achieve 100% branch coverage.