Skip to content

Serializing vector #1085

Description

@yuvalyo

at this moment i'm working on a little project and i'm trying to serialize a vector

the current code is:

std::string JsonResponsePacketSerializer::serializeResponse(HighscoreResponse response)
{
	json j;
	j["status"] = response.status;
	j["highscores"] = {};
	for (auto iter = response.highscores.begin(); iter != response.highscores.end(); ++iter)
	{
		j["highscores"].push_back(*iter);
	}


	return j.dump();
}

as you can see in the struct the "highscores" is a vector
but i'm gettting all kind of erros such as:

  1. could not find to_json() method in T's namespace
    2)forcing MSVC stacktrace to show which T we're talking about.

thanks for your help 👍

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions