added '/' to the characters escaped in JSON

This commit is contained in:
Alex Fabijanic
2014-05-28 21:05:30 -05:00
parent f306c51e43
commit 5cd3e842e8
2 changed files with 7 additions and 3 deletions

View File

@@ -70,9 +70,13 @@ void Stringifier::stringify(const Var& any, std::ostream& out, unsigned int inde
void Stringifier::formatString(const std::string& value, std::ostream& out)
{
out << '"';
for (std::string::const_iterator it = value.begin(); it != value.end(); ++it)
for (std::string::const_iterator it = value.begin(),
end = value.end(); it != end; ++it)
{
if (*it <= 0x1F || *it == '"' || *it == '\\') out << '\\';
if (*it <= 0x1F || *it == '"' || *it == '\\' || *it == '/')
{
out << '\\';
}
out << *it;
}
out << '"';