Skip to content

jsoncpp discards everything after zero character ('\0') #240

Closed
@vdudouyt

Description

@vdudouyt

Hi!

Here I'm trying to build a system that relies on storing some of it's internal structures in JSON format. Some of fields may contain the binary data, and I mentioned that everything after '\0' is getting discarded - just as in old good "plain C" strings:

int main()
{
   Json::FastWriter writer;
   Json::Value root;
   root["some_binary_value"] = std::string("\1\2\0\3\4", 5);
   std::cout << writer.write(root);
}
$ ./json_test
{"some_binary_value":"\u0001\u0002"}

Could you please let me know if that's something that you'd like to be fixed?
Thank you very much for your time, and sorry for bothering you with a such sort of things!

Valentin

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions