terminate called after throwing an instance of 'nlohmann::detail::parse_error'
what(): [json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing object key - unexpected end of input; expected string literal
Trying to use JSON parsing from local data.json
file with C++.
Code is as follows:
#include <iostream>
#include <stdio.h>
#include <string>
#include <fstream>
#include "json.hpp"
using namespace std;
using json = nlohmann::json;
int main() {
string text;
int x;
string jsonguy[5];
ifstream i("data.json");
i >> text;
json data = json::parse(text);
i.close();
return 0;
}
I have the Nlohmann json.hpp
imported locally. It continues to report these errors, how do I fix it?