I need a working c++ code for reading document from file using rapidjson: https://code.google.com/p/rapidjson/
In the wiki it's yet undocumented, the examples unserialize only from std::string, I haven't a deep knowledge of templates.
I serialized my document into a text file and this is the code I wrote, but it doesn't compile:
#include "rapidjson/prettywriter.h" // for stringify JSON
#include "rapidjson/writer.h" // for stringify JSON
#include "rapidjson/filestream.h" // wrapper of C stream for prettywriter as output
[...]
std::ifstream myfile ("c:\\statdata.txt");
rapidjson::Document document;
document.ParseStream<0>(myfile);
the compilation error state: error: 'Document' is not a member of 'rapidjson'
I'm using Qt 4.8.1 with mingw and rapidjson v 0.1 (I already try with upgraded v 0.11 but the error remain)
#include <rapidjson/document.h>
#include <rapidjson/istreamwrapper.h>
#include <fstream>
using namespace rapidjson;
using namespace std;
ifstream ifs("test.json");
IStreamWrapper isw(ifs);
Document d;
d.ParseStream(isw);
Please read docs in http://rapidjson.org/md_doc_stream.html .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With