Skip to content
/ jsmnpp Public

jsmn++ is a tiny json parser embedded in your C++ project for configuration.

License

Notifications You must be signed in to change notification settings

luoyetx/jsmnpp

Repository files navigation

jsmn++

jsmn++ is a tiny json parser embedded in your C++ project for configuration. The Tokenizer is from jsmn.

Embedded in your C++ project

If you are using CMake, simply use include(jsmnpp/libjsmn.cmake). If not, add jsmn.h, jsmn.c, jsmn.hpp, jsmn.cpp files to your build system.

Usage

#include <jsmn.hpp>
using namespace std;

// parse
Object o = parse("/path/to/config.json");

// get number
double num = o["num"].unwrap<Number>();
// get boolean
bool b = o["bool"].unwrap<Boolean>();
// get string
string s = o["str"].unwrap<String>();
// get array
Array a = o["array"].unwrap<Array>();
// get object
Object obj = o["object"].unwrap<Object>();

// serialize objcet
string json_string = serialize(o);

License

BSD 3-Clause

About

jsmn++ is a tiny json parser embedded in your C++ project for configuration.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published