mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 10:32:56 +01:00
stringify method output wrong json string #891
This commit is contained in:
@@ -58,7 +58,9 @@ void Stringifier::stringify(const Var& any, std::ostream& out, unsigned int inde
|
||||
}
|
||||
else if (any.isNumeric() || any.isBoolean())
|
||||
{
|
||||
out << any.convert<std::string>();
|
||||
std::string value = any.convert<std::string>();
|
||||
if (any.type() == typeid(char)) formatString(value, out);
|
||||
else out << value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -322,6 +322,11 @@ void JSONTest::testStringProperty()
|
||||
std::string value = test.convert<std::string>();
|
||||
assert(value.compare("value") == 0);
|
||||
|
||||
object.set("test2", 'a');
|
||||
std::ostringstream ostr;
|
||||
object.stringify(ostr);
|
||||
assert(ostr.str() == "{\"test\":\"value\",\"test2\":\"a\"}");
|
||||
|
||||
DynamicStruct ds = object;
|
||||
assert (!ds["test"].isEmpty());
|
||||
assert (ds["test"].isString());
|
||||
|
||||
Reference in New Issue
Block a user