You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
The addString call doesn't appear to provide and JSON escaping.
e.g. if I do
std::string fileTag("File");
std::string fileName("File");
node.setString(fileTag, fileName);
then I call dump I'll get:
{
"file":"c:\foo"
}
which is invalid JSON.
I noticed that WJWriteString does escaping, but that doesn't seem to be called by dump or setString.
Is it expected that the clients must hand the library properly escaped JSON strings or is this a bug, or is dump not the right way to extract the JSON?
The text was updated successfully, but these errors were encountered:
I fixed the issue and also added output stream insertion methods for Node objects so that you can send a node to a stream in the normal way:
std::cout << node << std::endl;
This will not be pretty printed so is the ideal way to create json files not intended for human consumtion.
You can continue to use the dump() method if you want pretty printed output.
Please pull an update from github.
From: sinukus [mailto:[email protected]]
Sent: Thursday, 5 November 2015 9:08 a.m.
To: petehug/wjelement-cpp [email protected]
Subject: [wjelement-cpp] String fields and escaping (#4)
Hi,
The addString call doesn't appear to provide and JSON escaping.
e.g. if I do
std::string fileTag("File");
std::string fileName("File");
node.setString(fileTag, fileName);
then I call dump I'll get:
{
"file":"c:\foo"
}
which is invalid JSON.
I noticed that WJWriteString does escaping, but that doesn't seem to be called by dump or setString.
Is it expected that the clients must hand the library properly escaped JSON strings or is this a bug, or is dump not the right way to extract the JSON?
Hi,
The addString call doesn't appear to provide and JSON escaping.
e.g. if I do
std::string fileTag("File");
std::string fileName("File");
node.setString(fileTag, fileName);
then I call dump I'll get:
{
"file":"c:\foo"
}
which is invalid JSON.
I noticed that WJWriteString does escaping, but that doesn't seem to be called by dump or setString.
Is it expected that the clients must hand the library properly escaped JSON strings or is this a bug, or is dump not the right way to extract the JSON?
The text was updated successfully, but these errors were encountered: