Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Aeldit/JsonParserCPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Parser C++

json-parser-cpp

This JSON parser was created from scratch, the parsing part being taken from my pure C version of this project.

Build

To build the program, first clone it from GitHub :

git clone https://github.com/Aeldit/JsonParserCPP.git

Then, enter the following commands

./configure
make json-parser
./json-parser <your_json_file.json>

The configure script accepts the following options :

  • S : Runs the script with the -fsanitize=address g++ flag (checks for memory leaks)
  • D : Displays some debug informations
  • SD or DS : Use both options

Makefile rules

Base rules :

  • all : compiles and runs the program with the file r.json
  • clean : removes the executable (this rule is called by all the other except tests)
  • test : runs some miscellaneous tests

Valgrind rules :

  • valgrind-compile : compiles the parser with the -DVALGRING_DISABLE_PRINT flag (disables the printing functions to only have the time of the parsing functions when using a profiler)
  • valgrind : calls valgrind-compile and generates a callgrind file usable by the KCachegrind profiling software
  • leaks : checks for leaks but using valgrind (using the file r.json)

Compilation options

You can change some defines directly at compilation time, depending on your use of this parser

MAX_READ_BUFF_SIZE

Defines the maximum size of the allocated buffer that is used to store the file (defaults to 2 << 30, which is roughly equals to 1GB)

MAX_NESTED_ARRAYS

Defines the maximum number of nested arrays (defaults to UINT_FAST8_MAX)

If you want to change this, you can use the following additional flag -DMAX_NESTED_ARRAYS=<your_value>

MAX_NESTED_DICTS

Defines the maximum number of nested dict objects (defaults to UINT_FAST8_MAX)

If you want to change this, you can use the following additional flags -DMAX_NESTED_DICTS=<your_value>

About

JSON parser written in C++

Resources

Stars

Watchers

Forks