I've been trying to implement this solution and I have been consistently getting the same stream error, regardless of the json file or example I use/follow. I know I'm probably doing something silly but I'm a lowly junior in my CS degree. Here is my code:
#include "json.hpp"
#include <fstream>
using json = nlohmann::json;
int main() {
std::ifstream ifs{"file.json"};
json parsed_json = json::parse(ifs);
return 0;
}
and here is the json I've been using:
[
{
"stringKey": "Nathen",
"intKey": 236
},
{
"stringKey": "Emerald",
"intKey": 739
},
{
"stringKey": "Franco",
"intKey": 544
}
]
and here is the error:
/home/bry/CLionProjects/jsonexample/cmake-build-debug/jsonexample terminate called after throwing an instance of 'std::invalid_argument' what(): stream error Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
I've been trying to implement this solution and I have been consistently getting the same stream error, regardless of the json file or example I use/follow. I know I'm probably doing something silly but I'm a lowly junior in my CS degree. Here is my code:
and here is the json I've been using:
and here is the error:
/home/bry/CLionProjects/jsonexample/cmake-build-debug/jsonexample terminate called after throwing an instance of 'std::invalid_argument' what(): stream error Process finished with exit code 134 (interrupted by signal 6: SIGABRT)