My C++ program below is supposed to read a json file called english.json
and display the "title" information.
#include <iostream>
#include <fstream>
#include <json/value.h>
using namespace std;
int main()
{
Json::Value language;
ifstream language_file("english.json", std::ifstream::binary);
language_file >> language;
cout << language["title"] << endl;
return 0;
}
But when I run the program, I get this error : E0349 No operator ">>" matches these operands
I've tried using other functions in the jsoncpp library but I'm getting more errors and this method seems to be the simplest and most effective.
<json/value.h>
doesn't include the full implementation of JsonCpp, you need to include <json/json.h>
instead.
operator >>
is defined in the json/reader.h
header