How to design api spec for recursive data

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?