- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Mon, 29 Jun 2015 21:21:24 +0200
- To: <public-linked-json@w3.org>
On Saturday, June 27, 2015 7:19 AM, Milan Simonovic
> Hi,
>
> I’m reading the spec and it seems like a value can always either be a single
> item/object or an array. For example:
>
> http://www.w3.org/TR/json-ld/#sets-and-lists
Yes, that's true. Whether it makes sense from the vocabularies point of view is a different question though.
> EXAMPLE 43: Using an expanded form to set multiple values
> {
> "@id": "http://example.org/articles/8",
> "dc:title":
> [
> {
> "@value": "Das Kapital",
> "@language": "de"
> },
> {
> "@value": "Capital",
> "@language": "en"
> }
> ]
> }
> and it’s also valid to use a single value:
>
> {
> "@id": "http://example.org/articles/8",
> "dc:title": “Capital”;
> }
>
> So a client should always handle both cases?
Yes. Even if it weren't allowed by the vocabulary (it is definitely allowed by JSON-LD) your client should be able to handle it without breaking.
> And also from the
> server’s perspective, when is it ok to replace a single item with an
> array?
Always. It doesn't change the meaning of the response. Clients can use the various JSON-LD API methods [1] to make bring the document into a specific shape.
Cheers,
Markus
[1] http://www.w3.org/TR/json-ld-api/
--
Markus Lanthaler
@markuslanthaler
Received on Monday, 29 June 2015 19:22:06 UTC