4 ms·
Ok, to be fair, I would say that JSON-LD could solve the problem of sending typed data through the wire once we have typed-contracts between server and client (
by lolive 8y ago
Ok, to be fair, I would say that JSON-LD could solve the problem of sending typed data through the wire once we have typed-contracts between server and client (for example when everybody switches from JS+REST to TS+Swagger).
Imho, JSON-LD is a piece of crap (because it is based on JSON, that is flawed by design).
So I would definitely promote the usage of RDF/N3 (and its N3.parse()) as the way to go when you need to transmit typed graphs from server to client.
Note: N3 is a dialect of RDF, that is super easy to serialize and deserialize, that builds graphs of objects in memory (which JSON cannot do, because it can only describe trees). And that (almost always) follows a normalized vocabulary for types, IDs and labels.
- lolive 8y agoHere is a small primer that i wrote on HN about N3: https://news.ycombinator.com/item?id=14476070 https://news.ycombinator.com/item?id=14476070 (as you can see, nothing very complex :)
- lolive 8y agoOh, and for your information, N3 has always had a reification syntax. For example: { [ x:firstname "Ora" ] dc:wrote [ dc:title "Moby Dick" ] } a n3:falsehood . PS: yep, there are blank nodes here. PPS: very few parsers take this into account, I agree. But I am pretty sure N3.parse() does.