Skip to content

markovolimango/JSON-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Parser

A C++ app that parses JSON and evaluates user expressions.

Features

  • Evaluating trivial expressions with JSON paths
  • min() and max() functions
    • Work with an array or multiple arguments
  • size() function
    • Works with arrays and objects
  • Expressions and functions in the subscript operator []
    • Allows for recursive function and expression calls
  • Binary arithmetic operations with expressions

Using the Application

Prerequisites

  • C++ 20 or later
  • CMake 3.29 or later

Buidling the Project

  • Clone the repository.
git clone https://github.com/markovolimango/JSON-Parser.git
  • Create a build directory and navigate to it.
cd JSON-Parser
mkdir build
cd build
  • Generate the build files using CMake.
cmake ..
  • Build the project.
make

Running the expression evaluation

  • Place your JSON file in the build directory.
  • Run the json_eval executable and input the file name and expression.
./json_eval
[filename] [expression]

Examples:

./json_eval
test.json a.b[1]
./json_eval
test.json a.b[max(0,a.b[1])]
./json_eval
test.json a.b[3][1]+a.b[size(a)]

Running the tests

  • Just run the tests executable.
./tests

About

json expression parser console app in c++

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors