Is there a way to not escape slashes when parsing JSON?

bachmeier no at
Mon Feb 21 22:10:40 UTC 2022

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"}`);

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 

More information about the Digitalmars-d-learn mailing list