I've been messing around with nlohmann's json library for a while but I can't figure out what I'm missing. I'm trying to read a bunch of json objects in at once and the file has 1 json object per line and I'm trying to parse all of them and store it into a vector.
int main(){
vector <json> alljSon;
std::ifstream i("test.json");
while (i.good()) {
json j;
i >> j;
alljSon.push_back(j);
}
return 0;
}
The problem is that if there's more than 1 json object, it gives me a the error message. "parse error - unexpected '{'; expected end of input" std::basic_string,std::allocator >. Any fixes?
Aucun commentaire:
Enregistrer un commentaire