Skip to content

Parse Error #1229

@louisb0

Description

@louisb0

I'm parsing JSON sent to a socketing server like so;

        try
 	{
		nlohmann::json json;
		json.parse(request);

		if (json[0].get<std::string>().find("z") != std::string::npos && json[0].get<std::string>().find("L") != std::string::npos &&
			json[0].get<std::string>().find("|") != std::string::npos && json[0].get<std::string>().find("jM") != std::string::npos)
			return true;
	}
	catch (nlohmann::detail::parse_error e)
	{
		c_logger::error(e.what());
		return false;
	}

This is the output from the server after receiving the request;

[~] = {"auth":"p4AzO|L1jMf=","request":"update_ips","ips":{"ip1":"144.12.123.11","ip2":"122.311.33.87","ip3":"91.122.31.633",},"ip_amount":3}
[~] [error] = [json.exception.parse_error.101] parse error at 120: syntax error - unexpected '}'; expected string literal

I really don't see what the issue is, it's probably something really stupid. Help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: proposed fixa fix for the issue has been proposed and waits for confirmation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions