On Monday, 21 February 2022 at 17:50:56 UTC, bachmeier wrote:

I looked at the source for `parseJSON` and I see references only to `JSONOptions.strictParsing` and `JSONOptions.specialFloatLiterals`. I may be missing something, but I don't see any option to iterating over every element and unescaping manually.

So it looks like `.toString(JSONOptions.doNotEscapeSlashes)` is the correct way to do what I need:

```
import std.conv, std.json, std.stdio;

void main() {
    auto json = parseJSON(`{"a": "path/file"}`);
    writeln(json["a"].toString);
    writeln(json["a"].to!string);
    writeln(json["a"].toString(JSONOptions.doNotEscapeSlashes));
}
```

I was using to!string to be consistent with my other D code, and thought that would be okay since toString returns the same value. What I didn't realize is that I might need to send options to toString.

Reply via email to