W3C home > Mailing lists > Public > public-linked-json@w3.org > August 2011

Escaping of forward slashes in JSON-LD

From: David I. Lehn <dil@lehn.org>
Date: Wed, 31 Aug 2011 16:45:23 -0400
Message-ID: <CADcbRRPRxWkvYg5sqvxoKZyw1fYYFTFD5yY8hb4dQjYBUgoXqw@mail.gmail.com>
To: Linked JSON <public-linked-json@w3.org>
On Mon, Aug 29, 2011 at 8:03 AM, Thomas Steiner <tomac@google.com> wrote:
> It has become a sometimes observable practice among JSON providers who
> deliver JSON over the Web in a way that it might end up in a <script>
> tag to escape forward slashes (aka. solidus) with a backward slash
> like so: "\/". This is due to the fact that within a <script> tag the
> string "</" may not occur. Given the ubiquity of IRIs (typically in
> the form of "http://") in JSON-LD (well, RDF in general), I was
> wondering whether we should make a statement with regards to forward
> slash escaping in the JSON-LD spec (i.e., "http:\/\/"). Note: escaping
> forward slashes is not required [1], however, e.g., PHP's
> json_encode() function by default adds slashes, whereas JavaScript's
> JSON.stringify() function does not. Opinions?

I added an issue about this.  A note should be added in the JSON-LD
spec normalization section about the issue but I'm not sure if the
spec needs to mandate one behavior over another.  It's more an issue
for JSON-LD applications that need consistent serialized JSON-LD.  If
you are just dealing with the object model itself you'll never see
this issue.


Received on Wednesday, 31 August 2011 20:45:52 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:53:18 UTC