Question

The examples for Collection+JSON do not show examples of nested collections. Can anyone point to an example of Collection+JSON using nested collections or describe an experience where they had success.

For example, would this work for a top level entry point that links to two sub-collections:

{
  "collection": {
    "version": "1.0",
    "href": "http://example.org/friends/",

    "links": [
      {
        "rel": "inbox",
        "href": "http://example.org/inbox"
      },
      {
        "rel": "contacts",
        "href": "http://example.org/contacts"
      }
    ]
  }
}
Was it helpful?

Solution

It's only a couple of months I've started working with collection+json, and I am not a complete expert.

I think that you are looking for inline collections:

https://github.com/collection-json/extensions/blob/master/inline.md

(it's still not in the official specs, but it has been proposed as an extension)

This is the main github page for all things collection+json

https://github.com/collection-json

update: Just found this discussion https://groups.google.com/forum/#!topic/collectionjson/fsVSVaHl79I where the use of inline collections is discouraged towards other ways to define them https://groups.google.com/forum/#!topic/collectionjson/fsVSVaHl79I .

I think that the best way would be to try with an approach and see how well it fits in your problem space, being a relatively new spec a lot of things still need to be ironed out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top