diff options
author | Patrick Simianer <p@simianer.de> | 2014-07-13 14:04:45 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-07-13 14:04:45 +0200 |
commit | 625269764ebbe8d0b566e6ef5fc26a6bccd4181d (patch) | |
tree | 70c54cb1dae9afddaefd7f0824427e95dd688081 /test_jsoncpp.cc |
init
Diffstat (limited to 'test_jsoncpp.cc')
-rw-r--r-- | test_jsoncpp.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test_jsoncpp.cc b/test_jsoncpp.cc new file mode 100644 index 0000000..ab3bd0c --- /dev/null +++ b/test_jsoncpp.cc @@ -0,0 +1,29 @@ +#include <iostream> +#include <fstream> +#include <string> + +/* + * https://github.com/open-source-parsers/jsoncpp + * + */ +#include "jsoncpp/include/json/json.h" + +using namespace std; + + +int +main(int argc, char** argv) +{ + ifstream ifs(argv[1]); + string json_str((istreambuf_iterator<char>(ifs)), + (istreambuf_iterator<char>())); + + Json::Value v; + Json::Reader reader; + reader.parse(json_str, v); + Json::Value last_edge = v["edges"][v["edges"].size()-1]; + cerr << last_edge["rule"].asString().substr(1, 4) << endl; + + return 0; +} + |