We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey, i have such code
std::vector<ConfigStructures::MyConfigs> MyConfigs; json JsonData; struct MyConfigs { bool selected = false; std::string Name; }; inline void to_json(json& j, const MyConfigs& config) { j = json{ { "selected", config.selected }, { "name", config.Name } }; } inline void from_json(const json& j, MyConfigs& config) { config.selected = j.at("selected").get < bool >(); config.Name = j.at("name").get < int >(); }
i can serialize to json, as i set to_json function JsonData = MyConfigs;
JsonData = MyConfigs;
But i can't do this MyConfigs = JsonData
MyConfigs = JsonData
Try do like this: MyConfigs = JsonData.get < vector<ConfigStructures::MyConfigs> >(); and this
MyConfigs = JsonData.get < vector<ConfigStructures::MyConfigs> >();
MyConfigs.clear(); for (auto& element : JsonData) { MyConfigs.push_back(element); }
But it give me error: JSON_THROW(type_error::create(302, "type must be number, but is " + j.type_name()));
JSON_THROW(type_error::create(302, "type must be number, but is " + j.type_name()));
The text was updated successfully, but these errors were encountered:
Does it work now?
Sorry, something went wrong.
No branches or pull requests
Hey, i have such code
i can serialize to json, as i set to_json function
JsonData = MyConfigs;
But i can't do this
MyConfigs = JsonData
Try do like this:
MyConfigs = JsonData.get < vector<ConfigStructures::MyConfigs> >();
and this
But it give me error:
JSON_THROW(type_error::create(302, "type must be number, but is " + j.type_name()));
The text was updated successfully, but these errors were encountered: