For web developers that are not (yet) accustomed to Linked Data it is much easier to build apps that can handle JSON trees.
Luckily there is JSON-LD, a JSON serialization of RDF, and Node Solid Server is able to serialize a resource as such:
curl --header Accept:application/ld+json https://angelo.veltens.org/profile/card
This will give you the data from my profile as JSON-LD.
Using JSON-LD Framing, you can easily apply a context and structure that fits your client app.
"name": "Angelo Veltens"
This way you can handle Linked Data as if it was just regular JSON. (Because it is, now).
You can find a running example in the JSON-LD playground.
Yup; just had a related conversation, which TBL answered in the Solid Gitter Chat.
I much prefer the JSON-LD syntax and form; makes working with Linked Data much more exciting imo.
Looks good. How would this work in practice? Are there any examples of apps that use JSON-LD?
I am currently working on libraries that are based on JSON-LD. But this ist still in a very early / experimental phase.
OK thanks. I’m not familiar with react. Could you provide an example using JS? For example, can i do an ajax request and retrieve the results as JSON-LD as opposed to turtle? If so, how?
You just have to set the accept header to
Accept:application/ld+json. You can then use jsonld.js on client side.
Here is a JSFiddle that demonstrates applying a client context after loading data from backend