#include <iostream>
#include "rapidjson/rapidjson.h"
#include "rapidjson/document.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"
#include "rapidjson/filereadstream.h"
#include "cstdio"
using namespace std;
using namespace rapidjson;
int main() {
const char json[] = "[1, 2, 3]";
StringStream s(json);
Document document;
document.ParseStream(s);
for (int i = 0; i < 3; i++)
std::cout << document[i].GetInt() << std::endl;
StringBuffer SB;
Writer<StringBuffer> writer(SB);
document.Accept(writer);
std::cout << SB.GetString() << std::endl;
FILE* fp = fopen("test.json", "rb");
char readBuffer[65535];
FileReadStream is(fp, readBuffer, sizeof(readBuffer));
document.ParseStream(is);
fclose(fp);
for (Value::ConstMemberIterator it = document.MemberBegin();
it != document.MemberEnd(); it++)
std::cout << (it->name).GetString() << std::endl;
}