I'm trying to create a Codable Struct in Swift based on the JSON I'm receiving.
The Json I have is:
{
"data": [
{
"id": "a123b321c456xyz",
"timeUsed": 12345678,
"input": [
[
"address_1a123b321c456xyz",
{
"getSomeString": "0123456789",
"getSomeObjectArray": []
}
],
[
"address_2a123b321c456xyz",
{
"getSomeString": "0123456789",
"getSomeObjectArray": []
}
]
],
"output": [
[
"address_3a123b321c456xyz",
{
"getSomeString": "0123456789",
"getSomeObjectArray": []
}
],
[
"address_4a123b321c456xyz",
{
"getSomeString": "0123456789",
"getSomeObjectArray": []
}
]
],
"getSomeData": {
"getSomeString": "0123456789",
"getSomeObjectArray": []
}
}
]
}
The Models that I tried to use
struct RequestData: Codable {
let data: [RequestMyData]
}
struct RequestMyData: Codable {
let id: String
let timeUsed: Int
let input: [MixedData]
let output: [MixedData]
let getSomeData: GetSomeData
}
struct MixedData: Codable {
//What should I do here?
}
struct GetSomeData: Codable {
let getSomeString: String
let getSomeObjectArray: [Object]
}
So, what confuses me is this part of JSON:
[
"address_1a123b321c456xyz",
{
"getSomeString": "0123456789",
"getSomeObjectArray": []
}
],
If you need additional explanation, please comment below. Thank you in advance.