toy-level json parser & generator
- JavaScript Object Notation
- A data-interchange format, originated from JS
- Features: lightweight, which is easy for
- humans to read & write
- machines to parse & generate
- Applications, e.g.,
- Web API response format
- Document-oriented database
- Components: standardized parser and generator
- ECMA-404 The JSON Data Interchange Standard
- e.g., recursive descent parser
- Language: C89
- LOC: approx. 4000
- Roadmap
- Parser: number --> string -> array --> object
- Parser --> Generator
- Limited support
- encoding, number type, correctness & efficiency, etc.
- As a so-called “high-level” programming experiment…
- Test-driven Development
- API design
- cross-platform
- unified code style
- dev tools: CMake, Valgrind, Doxygen, etc.
This project uses CMake for cross-platform builds and testing.
- CMake 3.10 or newer
- A C compiler (e.g., gcc, clang, MSVC)
- Clone the repository:
git clone https://github.com/yourusername/toy-json-lib.git cd toy-json-lib - Create a build directory and run CMake:
cmake -S . -B build - Build the project:
cmake --build build
After building, run the tests with:
cd build
ctest --output-on-failureThis will execute the test suite and show detailed output if any test fails.
API documentation can be generated using Doxygen:
doxygen DoxyfileThe generated HTML files will be placed in the docs directory.
[1] Introducing JSON https://json.org
[2] JSON from Wikipedia https://en.wikipedia.org/wiki/JSON
[3] The Rise and Rise of JSON by Two-Bit History https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html
[4] 从零开始的JSON库教程 by Milo Yip https://zhuanlan.zhihu.com/p/22457315
This project is distributed under the terms of the GNU General Public License version 3.0. See the LICENSE file for details.
