# How to decode JSON returning an array of arrays of different types

**URL:** <https://forums.swift.org/t/how-to-decode-json-returning-an-array-of-arrays-of-different-types/61373>\
**Category:** Using Swift\
**Tags:** json, jsondecoder\
**Created:** [November 11, 2022, 8:14am UTC](https://forums.swift.org/t/how-to-decode-json-returning-an-array-of-arrays-of-different-types/61373 "2022-11-11T08:14:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![libhut-samwes](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/libhut-samwes/32/27581_2.png) [@libhut-samwes](https://forums.swift.org/u/libhut-samwes)\
**Post date:** [November 11, 2022, 8:14am UTC](https://forums.swift.org/t/how-to-decode-json-returning-an-array-of-arrays-of-different-types/61373/1 "2022-11-11T08:14:06Z")

</div>

I am trying to get JSON from an external source, using AlamoFire tools. Using the .responseJSON method works, but that will be deprecated and in any case I know .responseDecodable is more sound. However, I cannot figure out how to model the data so it will decode. Here is the returned JSON:

```swift
{
    p = 1668147588893;
    q = {
        cue = (
                        (
                1667442513807,
                                {
                    done = 0;
                    link = new;
                    share = 0;
                    tags = new;
                    title = new;
                }
            ),
                        (
                1667442494796,
                                {
                    done = 0;
                    link = "~.new";
                    share = 0;
                    tags = new;
                    title = new;
                }
            ),
                        (
                1667441502089,
                                {
                    done = 1;
                    link = "~.s";
                    share = 0;
                    tags = s;
                    title = gogogo;
                }
            )
);
};
}

```

I am working on the model, but cannot figure out how to deal with the first element of each underlying item having no key value. Otherwise I think this would be trivially easy. I'm sure there must be some way to use init and a custom decoder, but I cannot figure it out. So far I just have:

```swift
struct Response: Decodable {
    let p: Int
    let q: CueFeed
}

struct CueFeed: Decodable {
    let cue: [CueItem]
}

```

But I don't know how to write the struct for CueItem.
