coreJSON  v3.0.1
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 (example generated with GCC for ARM Cortex-M)
File
With -O1 Optimization
With -Os Optimization
core_json.c
2.7K
2.2K
Total estimates
2.7K
2.2K

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.