RE: convert JSON to JSON-LD?

Hi Joakim,

On Tuesday, November 05, 2013 2:53 AM, Joakim Soderberg wrote:
> Hi,
> Is it possible to convert JSON to JSON-LD. Do you have an example?

Yes, that's possible. In most cases, all you have to do is to add a JSON-LD
context to the data. This can either be done directly in the document (in
case you serve it as application/ld+json) or via an HTTP Link header [1] (if
you wanna continue to serve it as application/json).

You can also use Antonio Garrote's json-ld-macros [2]. I explained its usage
in a mail earlier this year:

  http://lists.w3.org/Archives/Public/public-linked-json/2013May/0027.html


Please note that the jsfiddle link in that mail doesn't work anymore as
Futures have been renamed to Promises. Here's the updated demo:

  http://jsfiddle.net/9ZU8q/6/


HTH,
Markus


[1] http://www.w3.org/TR/json-ld/#interpreting-json-as-json-ld
[2] https://github.com/antoniogarrote/json-ld-macros


--
Markus Lanthaler
@markuslanthaler

Received on Tuesday, 5 November 2013 09:57:29 UTC