Unexpected behavior of std.json.toJSON

Peter Sommerfeld noreply at rubrica.at
Mon Jan 7 15:16:48 PST 2013


Sample code:
-------------------
import std.stdio;
import std.json;
void main(string[] args){

   string text = "{ \"url\":\"http://www.boost.org\" }";
   JSONValue json = parseJSON(text);

   writeln(toJSON(&json));
   // prints: { "url":"http\/\/www.boost.org\" }
   // The same happens when writing to a file.
}
--------------------

The double slash "//" in the url is replaced by "\/\/".
Is that a feature or a bug? If the former, what is the
reason for this behavior and how to avoid it?

Peter


More information about the Digitalmars-d-learn mailing list