Re: [basex-talk] Question about JSON parsing/serializing

2021-03-22 Thread Hans-Juergen Rennau
In my case, it's readability. I've started work on a BaseX-based tool for analyzing and reporting OpenAPI documents. In that domain, according to my experience, slashes are never escaped. Tool output cluttered up with backslashes would be inacceptable - just consider how URLs and JSON Pointers

Re: [basex-talk] Question about JSON parsing/serializing

2021-03-22 Thread Hans-Juergen Rennau
Oh, thank you, Christian - only now I understand the option "escape" of json:serialize (do I?)! I thought it was about how to *represent* the input characters (apply optional escaping or not), but in fact it is (also) about how to *interpret* them - interpret them in the XDM way (escape=yes) or

Re: [basex-talk] Question about JSON parsing/serializing

2021-03-22 Thread Christian Grün
…and thanks for your reply. Out of interest: What’s your main reason for trying to avoid escaped slashes in the JSON result? Is it “only” about better readability, or about a technical problem, e.g. a JSON processor that cannot handle backslashed slashes? I’m asking because we already had a clien

Re: [basex-talk] Question about JSON parsing/serializing

2021-03-22 Thread Christian Grün
Dear Hans-Jürgen, > I was speaking about function json:serialize, which does not support the > option "use-character-maps". I still think option "escape=no" must not leave > double quotes or backslashes without escaping, as it produces invalid JSON > and a serialization function producing inval

Re: [basex-talk] Question about JSON parsing/serializing

2021-03-22 Thread Hans-Juergen Rennau
You are right, Gerrit - the desired output can be achieved using fn:serialize and the use-characgter-maps option:   serialize($doc, map{'method': 'json', 'use-character-maps': map{'/': '/'}}) I had overlooked that, and it's good to know. I was speaking about function json:serialize, which does n

Re: [basex-talk] Question about JSON parsing/serializing

2021-03-22 Thread Imsieke, Gerrit, le-tex
What’s wrong with adding 'use-character-maps': map{'/': '/'} to the JSON serialization each time? On 22.03.2021 08:05, Hans-Juergen Rennau wrote: Good Morning, Liam, thank you very much for this precise link into the video, showing the "why" behind escaping slashes. In spite of the incorrect

Re: [basex-talk] Question about JSON parsing/serializing

2021-03-22 Thread Hans-Juergen Rennau
Good Morning, Liam, thank you very much for this precise link into the video, showing the "why" behind escaping slashes. In spite of the incorrect "must escape", your previous post was key to me for understanding my error. It is absolutely crucial to understand that within the JSON model, "/" a