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

Escaping of forward slashes in JSON-LD

From: Thomas Steiner <tomac@google.com>
Date: Mon, 29 Aug 2011 14:03:51 +0200
Message-ID: <CALgRrL=V=6XOfi0=aA0-CGNyBqa4M+iCUaZs1C7vnv22q0qA4w@mail.gmail.com>
To: Linked JSON <public-linked-json@w3.org>
Hi all,

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?


[1] http://json.org/string.gif

Thomas Steiner, Research Scientist, Google Inc.
http://blog.tomayac.com, http://twitter.com/tomayac
Received on Monday, 29 August 2011 12:05:26 UTC

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