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

2022-02-21 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 22 February 2022 at 00:44:58 UTC, jmh530 wrote: On Tuesday, 22 February 2022 at 00:36:38 UTC, bachmeier wrote: [snip] Yes. std.random is another. I gave up out on the current one. Luckily I already had external libraries for that before I started using D. Have you tried mir.rand

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

2022-02-21 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 22 February 2022 at 00:36:38 UTC, bachmeier wrote: [snip] Yes. std.random is another. I gave up out on the current one. Luckily I already had external libraries for that before I started using D. Have you tried mir.random?

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

2022-02-21 Thread bachmeier via Digitalmars-d-learn
On Monday, 21 February 2022 at 22:58:17 UTC, Ali Çehreli wrote: On 2/21/22 09:34, bachmeier wrote: > I may have to look for an alternative > JSON library for D. std.json is not the most fun independent of this issue. std.json is a very good module. At work, we had to write additional code to c

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

2022-02-21 Thread Ali Çehreli via Digitalmars-d-learn
On 2/21/22 14:58, Ali Çehreli wrote: > std.json is a very good module. Correction: std.json is NOT a very good module. Ali

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

2022-02-21 Thread bauss via Digitalmars-d-learn
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 lib

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

2022-02-21 Thread Ali Çehreli via Digitalmars-d-learn
On 2/21/22 09:34, bachmeier wrote: > I may have to look for an alternative > JSON library for D. std.json is not the most fun independent of this issue. std.json is a very good module. At work, we had to write additional code to cover its defficiencies. Looking forward to versioning in Phob

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

2022-02-21 Thread bachmeier via Digitalmars-d-learn
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 unes

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

2022-02-21 Thread bachmeier via Digitalmars-d-learn
On Monday, 21 February 2022 at 17:32:23 UTC, bachmeier wrote: On Monday, 21 February 2022 at 04:02:23 UTC, Steven Schveighoffer wrote: On Monday, 21 February 2022 at 03:42:55 UTC, bachmeier wrote: I tried this ```d import std.json, std.stdio; void main() { writeln(parseJSON(`{"a": "path/f

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

2022-02-21 Thread bachmeier via Digitalmars-d-learn
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. Escaping slashes as a default is a huge mistake IMHO

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

2022-02-21 Thread bachmeier via Digitalmars-d-learn
On Monday, 21 February 2022 at 04:02:23 UTC, Steven Schveighoffer wrote: On Monday, 21 February 2022 at 03:42:55 UTC, bachmeier wrote: I tried this ```d import std.json, std.stdio; void main() { writeln(parseJSON(`{"a": "path/file"}`, JSONOptions.doNotEscapeSlashes)); } ``` but the outp

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

2022-02-21 Thread Kagamin via Digitalmars-d-learn
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. wi

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

2022-02-21 Thread bauss via Digitalmars-d-learn
On Monday, 21 February 2022 at 03:42:55 UTC, bachmeier wrote: I tried this ``` import std.json, std.stdio; void main() { writeln(parseJSON(`{"a": "path/file"}`, JSONOptions.doNotEscapeSlashes)); } ``` but the output is ``` {"a":"path\/file"} ``` Is there a way to avoid the escaping of

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

2022-02-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 21 February 2022 at 03:42:55 UTC, bachmeier wrote: I tried this ```d import std.json, std.stdio; void main() { writeln(parseJSON(`{"a": "path/file"}`, JSONOptions.doNotEscapeSlashes)); } ``` but the output is ``` {"a":"path\/file"} ``` Is there a way to avoid the escaping of

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

2022-02-20 Thread bachmeier via Digitalmars-d-learn
I tried this ``` import std.json, std.stdio; void main() { writeln(parseJSON(`{"a": "path/file"}`, JSONOptions.doNotEscapeSlashes)); } ``` but the output is ``` {"a":"path\/file"} ``` Is there a way to avoid the escaping of the forward slash? Is there some reason I should want to escap