summaryrefslogtreecommitdiff
path: root/src/test_jsoncpp.cc
blob: ab3bd0c96559d7304b7f10f3a87c769a42e6eb7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;
}