Roman Susi
Roman Susi

Reputation: 4199

Can compacting arrays be more selective in JSON-LD framing?

In the question JSON-LD framing single object arrays was asked on how to make arrays from single objects while framing JSON-LD for all arrays (by adding an compactArrays option).

Is there any way to do it selectively? Starting from always having "@graph", and after that for some "major" nodes. Maybe some parameter can be given in the frame to indicate exception of the general option?

In my case arrays are actually sets.

Upvotes: 0

Views: 223

Answers (1)

Markus Lanthaler
Markus Lanthaler

Reputation: 3823

Yep, you can do it per-property by setting the @collection attribute of the property to @set:

{
  "@context": {
    "arrayProperty": {
      "@id": "http://example.com/something",
      "@container": "@set"
    }
  },
  ...
  "arrayProperty": []
}

Upvotes: 1

Related Questions