JSON in C (Work in Progress)

Frank Mitchell

Posted: 2023-04-12
Last Modified: 2023-04-13
Word Count: 185
Tags: c-programming lua programming python ruby

Table of Contents

This project will create a C library to parse and emit JSON. It will then provide wrappers for various languages including Lua, Python, and Ruby.

Design

Since there are so many C JSON parsers already, this one will try to do things a little differently:

  1. It will offer a “pull parser” interface modeled after JSONPP.
  2. Instead of building a tree, the layer above the pull parser will return a tree walker similar to that of ELTN-C.
  3. The implementation will attempt to avoid allocation and leaks in general. The one exception may be the Json_String API, which tries to balance the need for better strings in C with the hazards of reference counting without smart pointers.

API

TODO

I/O

See also CPorts.

TODO

String

See also M-Strings and E-Strings.

TODO

Parser

TODO

Tree

TODO

Wrappers

Wrappers will use native I/O to construct a tree of native equivalents to JSON Arrays and Objects.

Lua

The parser will create a tree of tables.

TODO

Python

The parser will create a tree of dictionaries and lists.

TODO

Ruby

The parser will create a tree of Arrays and Hashes.

TODO