Where to put included for single resources?


I have a REST api where doing a GET on /sku/17 gives you a stockkeeping unit record. It’s for a point of sale app I’m making. I have this looking like this:

“type”: “sku”,
“id”: 17,
“attributes”: {

“links”: {

“relationships”: {


My question: where do I put the included objects? If I put it at the top-level, it looks like it’s part of the resource object itself.

When I get all skus, the list of skus is nested within a data record. So, it’s easy to put the included records outside of data. like so

“data”: [{

“included”: {


Thank you!!!


In your top example, you’re missing data. The data property is always there. It should be:

   "data" :
      "type": "sku",
      "id": 17,
      "links": {},
    "included" :
      // other identifiable resources


Thank you, brainwipe. I’ll implement it that way.

There’s a bug in the specification. http://jsonapi.org/format/ - in the “Resource Object” section, you can see it has the single resource like in my top example. It’s repeated in Resource Linkage and Resource Links.


Ah, I see what you mean. There is a //... at the top. This because a resource object can be a child of data or includes. You do not return a resource object, you return a compound document, which can contain many resources. A document must have one of data, meta or links as it’s descendants.

I hope that clears it up.


Ah, I see. Yes, it does clear it up for me. Thank you for the excellent answer.