non-standard json output

Alix Pexton alix.DOT.pexton at gmail.DOT.com
Wed Jun 5 01:06:42 PDT 2013


On 04/06/2013 9:59 PM, Anthony Goins wrote:
> Is this a bug?
>
> "file" : "/home/anthony/projects/dcomposer/src/printui.d",
>
> A line from DMD 2.063 json output.
>
> "file" : "\/usr\/include\/d\/gsv\/SourceBuffer.d",
>
> A line from an older DMD version. Forward slashes escaped according to
> json standard.
>
> Hesitant to file a bug report because by the time I see something it's
> probably already well known and fixed.
>
>
>

I looked into this out of curiosity.
The solidus _can be_ escaped to allow JSON strings to contain XML 
closing tags (like </b>) while the JSON itself is wrapped by an XML element.

In contexts where the JSON is not going to be read by an XML parser, or 
will not make a potentially confusing closing tag (such as in part of a 
web address or file path) it becomes totally optional.

However, I also read that some buggy implementations of JSON parsers 
treat // as the beginning of a comment even when inside a string.

I hope that helps!

A...


More information about the Digitalmars-d mailing list