Is there a way to not escape slashes when parsing JSON?
bauss
jj_1337 at live.dk
Mon Feb 21 23:02:20 UTC 2022
On Monday, 21 February 2022 at 15:13:52 UTC, Kagamin wrote:
> On Monday, 21 February 2022 at 09:04:06 UTC, bauss wrote:
>> Why are we even escaping them by default, it should be the
>> other way around, that slashes are only escaped if you ask for
>> it; that's how it literally is in almost every JSON library.
>
> Really? I always see escaped slashes in JSON, e.g. wikipedia
> does this, but everything else too.
I'm going to assume that JS is probably the most used language
for JSON, since it originated from it, so a small demonstration
will show you that even JS defaults to not escaping slashes:
```
let o = { a: "/path/to/something" };
console.log(JSON.stringify(o));
```
Output:
```
{"a":"/path/to/something"}
```
More information about the Digitalmars-d-learn
mailing list