You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is is thrown, because from_json is called more than once:
First for the whole JSON document. There, a key "required" exists.
Then, recursively, in the translation of each course in the vector. However, elements like {"number": 104,"subject": "MATH","credits": 3} do not have a key "required", so at throws.
You should adjust your code to reflect that not every course needs to have a "required" key, e.g. like
if (j.find("required") != j.end())
j.at("required").get_to<std::vector<course>>(c.required);
As a side note, you do not need to call to_json explicitly. Code like
Can't quite figure out why I'm getting this error:
Here's my code:
Here's my .json file: https://hastebin.com/wizofetomu.json
I'd appreciate any help, I've continually reviewed the documentation but can't figure out what I'm doing incorrectly.
The text was updated successfully, but these errors were encountered: