Re: JSON-LD in examples invalid due to comments

On Thu, Nov 28, 2013 at 2:54 AM, Dan Brickley <danbri@google.com> wrote:

> On 28 November 2013 10:45, Markus Lanthaler <markus.lanthaler@gmx.net>
> wrote:
> > Hi,
> >
> > I've just realized that all (?) JSON-LD examples in schema.org are
> invalid
> > since they include comments. Just as JSON, JSON-LD doesn't support
> comments.
> >
> > Example 1 of http://schema.org/Action for instance begins as follows:
> >
> >   <script type="application/ld+json">
> >     // John listened to Pink with Steve at Anna's appartment on his iPod.
> >   {
> >     "@context": "http://schema.org",
> >     "@type": "ListenAction",
> >     ...
> >
> > The second line turns this into invalid JSON(-LD). It should thus be
> > rewritten to
> >
> >   <script type="application/ld+json">
> >   {
> >     "@context": "http://schema.org",
> >     "@type": "ListenAction",
> >     ...
> >
> >
> > Would it be possible to remove those comments at the beginning of all
> > examples? I fear that otherwise a lot of people will adapt this style
> which
> > will lead to severe interoperability problems.
>
> Fair point, thanks.


Point taken. I filed a bug report here against myself to get that cleaned
up.

I'll use some other form of commenting until we figure out how to embed
comments in json-ld.


> I took a look around at commenting options for
> JSON-LD recently, and it's pretty bleak. Some people are using
> repeated keys, others using predictably named alternate keys. For
> JSON-LD I'm not aware of an idiom that doesn't give rise to unwanted
> triples, but perhaps there's some hack possible?
>
> This does make me wonder about the W3C spec for embedding JSON-LD in
> HTML,
> http://www.w3.org/TR/2013/PR-json-ld-20131105/#embedding-json-ld-in-html-documents
> ... whether it would be wrong, bad and ugly to use HTML's inline
> comment syntax, i.e. <!-- ... -->.
>
> For the schema.org docs, we should probably just move the comments out
> of the <script>.
>
> cheers,
>
> Dan
>

Received on Monday, 2 December 2013 19:10:30 UTC