Skip to content

bug in JSON ParseHandler.cpp (empty keys should be valid) #1521

@vin-d

Description

@vin-d

Hi,
I'm using Poco 1.7.5 JSON module but from reading the code 1.7.6 has the same problem.
I have to parse a JSON string and have the following error with JSON files that have an empty key even if it is still valid to have an empty string in JSON (string is a sequence of zero or more Unicode characters) :

example :

{"example":
  {"":""}
}

and this code with the string describe above.

Poco::JSON::Parse p;
p.parse(myJsonString);

throws
because of

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Assertion violation: !_key.empty() [in file "src/ParseHandler.cpp", line 136]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This assert in line 136 shouldn't be there.
what do you think about this ?

Thank you.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions