C++ JSON Parser Protoype. Developped to apply for GSoC 2013.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
include
src
.gitignore
LICENSE.txt
Makefile
README.textile

README.textile

C++ JSON Parser Prototype

Motivation

This JSON parser prototype was written as part of a proposal for the Boost C++ library for The Google Summer of Code 2013.

JSON parsing is a simple yet practical application of complier design. In this implementation we are parsing a subset of the JSON data types into a Tree API with a recursive descent parser.

Overview

The current implementation uses a Builder pattern to separate “code generation” from parsing. In our case, “code generation” is the creation of a data structure that reflects JSON arrays and objects and the assignment of JSON values into the data structure.

Representation of JSON data in C++ is an interesting challenge, we use the Dynamic C++ library to represent dynamically typed data. JSON arrays are represented by arrays, and objects are represented by hashmaps.

We are using the JSON scanner from the protoc library as a Lexer.

You can have an overview of the API by looking at the unit tests

Thanks

A big thanks to Bjorn Reese for his mentoring and support during this prototype development.

Build

Dependencies: Boost and Boost.Test. On Debian, this is provided by the packages libboost1.48-dev and libboost-test1.48.0

The required parts of dynamic-cpp and protoc are included in the repository.

The Makefile is incomplete, you will need to create a bin/ and an obj/ folder in the project. Build has only been tested with g++ on a Linux environment. CMake is coming soon…

You can run the unit tests by typing bin/builder_test and bin/parser_test