# How to design api spec for recursive data

**URL:** <https://discuss.jsonapi.org/t/how-to-design-api-spec-for-recursive-data/1989>\
**Category:** Uncategorized\
**Created:** [July 3, 2020, 8:49am UTC](https://discuss.jsonapi.org/t/how-to-design-api-spec-for-recursive-data/1989 "2020-07-03T08:49:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![surbhi](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@surbhi](https://discuss.jsonapi.org/u/surbhi)\
**Post date:** [July 3, 2020, 8:49am UTC](https://discuss.jsonapi.org/t/how-to-design-api-spec-for-recursive-data/1989/1 "2020-07-03T08:49:14Z")

</div>

We have a unix directory like structure. So it looks like this :  
parentFolder :  
firstLevelChildFolder :  
secondLevelChildFolder :  
multiple files

So to design a response which confers to {json:api} specification, we came up with something like which includes relationships within relationships.

```
    "relationships": {
          "artifactFolders": {
            "data": {
              "type": "artifactFolder",
              "id": "AF1",
              "attributes": {
                "name": "test1"
              },
              "relationships": {
                "childFolder": {
                  "data": {
                    "type": "artifactFolder",
                    "id": "AF2",
                    "attributes": {
                      "name": "test2"
                    },

```

This seems to be failing the json:api format. Can somebody please help me with the right response structure?
