-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
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
Serializing vector #1085
Comments
Please have a look at this section of the README: https://github.com/nlohmann/json/blob/develop/README.md#arbitrary-types-conversions |
so you say i just need to do like: json j;
j["highscores"] = response.highscores; ? |
You need to provide a |
std::string JsonResponsePacketSerializer::serializeResponse(HighscoreResponse response)
{
json j = json{ { "status", response.status },{ "highscores", response.highscores }};
return j.dump();
} still does not work |
Can you provide the code of your |
void to_json(json& j, const HighscoreResponse& response)
{
j = json{ { "status", response.status },{ "highscores", response.highscores }};
} this is my to_json function but i need to know just hot to serialize the vector because from what i understood you can only convert normal types and not user_defined |
Is the If so, it means that some member of |
i just need to know how do you convert a std::vector to json |
Given |
Do you need further assistance on this? |
at this moment i'm working on a little project and i'm trying to serialize a vector
the current code is:
as you can see in the struct the "highscores" is a vector
but i'm gettting all kind of erros such as:
2)forcing MSVC stacktrace to show which T we're talking about.
thanks for your help 👍
The text was updated successfully, but these errors were encountered: