An open API service indexing awesome lists of open source software.

https://github.com/pb82/cpp_json_examples

A simple and flexible json library along with examples for how to use it
https://github.com/pb82/cpp_json_examples

Last synced: over 1 year ago
JSON representation

A simple and flexible json library along with examples for how to use it

Awesome Lists containing this project

README

          

# C++ JSON examples

This bundles a json library (producing and parsing) along with some examples for how to use it. `main.cpp` contains all of the examples along with comments.

## The contents

_json_: all source files

_json/include_: all headers

_io_: helper for file io

## Compiling the examples

Run `make all`, then run the compiled binary with `./a.out`. You should see all of the example output.

## Using the library in your own project

Copy the `json` subdirectory into your project and make sure that `parser.cpp` and `printer.cpp` are compiled. Take a look at the included _Makefile_ or _CMakeLists.txt_. Then just include the desired headers from `json/include` and use them.

All json definitions are contained in the `JSON` namespace, so you need to either prefix with `JSON::` or use `using namespace JSON` in your class or method.

## Tests

The unit tests are currently still located [here](https://github.com/pb82/Elson/tree/master/tests) but i'd like to move them to this repository (and eventually retire the old one).

## License

All of the code in this repository is licensed under the MIT license (included) except for `json/include/utf8.h` which is licensed under the Boost Software License 1.0 and part of [this project](https://github.com/nemtrif/utfcpp). License [here](https://github.com/nemtrif/utfcpp/blob/master/LICENSE).