summaryrefslogtreecommitdiff
path: root/src/test_rapidjson.cc
blob: b344ed0c58535f632c84c7b143ffc00f7ea352b7 (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
30
31
#include <iostream>
#include <fstream>
#include <string>
#include <string.h>

/*
 * https://github.com/miloyip/rapidjson
 *
 */
#include "rapidjson/include/rapidjson/rapidjson.h"
#include "rapidjson/include/rapidjson/document.h"
#include "rapidjson/include/rapidjson/stringbuffer.h"

using namespace std;


int
main(int argc, char** argv)
{
  ifstream ifs(argv[1]);
  string json_str((istreambuf_iterator<char>(ifs)),
                   (istreambuf_iterator<char>()));

  rapidjson::Document d;
  d.Parse(json_str.c_str());
  string s(d["edges"][d["edges"].Size()-1]["rule"].GetString());
  cerr << s.substr(1, 4) << endl;

  return 0;
}