I am receiving a JSON:

```
{
    "categories":
    [
        {
            "category_name": "example name",
            "children":
            [
                {
                    "category_name": "example name"
                },
                {
             ...

```

As can be seen, the data is a recursive format. I was able to write the code for decoding it into my custom type which is:

```
 struct Name: Codable {
        let cat: String
        let children: [cat]?
}

```

Now, for any cat, I would like to know the "path" of it. As in, I'd like know what are all the super(ancestor) categories. So, for the category "tablets", I would like to be able to traverse what the drill down structure looks like, which in this case could look like:

```
Electronics -> Computers -> Laptops and Tablets -> Tablets

```

How do I structure my code or data model to be able to retrieve this information for any category?