Hi.
I’m new to json.
I downloaded some information in json format, but it looks different from what I’ve seen in my searches.
The basic structures consists of two objects: an array of arrays without keys and an array of objects wiht key:value pairs.
{
“resultset”: [
[
“value0”,
“value1”,
“value2”,
“value3”,
“value4”,
“value5”,
“value6”,
“value7”,
“value8”
],
[
“value0”,
“value1”,
“value2”,
“value3”,
“value4”,
“value5”,
“value6”,
“value7”,
“value8”
],
<…>
[
“value0”,
“value1”,
“value2”,
“value3”,
“value4”,
“value5”,
“value6”,
“value7”,
“value8”
]
],
“metadata”: [
{
“colIndex”: 0,
“colType”: “String”,
“colName”: “key0”
},
{
“colIndex”: 1,
“colType”: “String”,
“colName”: “Key1”
},
{
“colIndex”: 2,
“colType”: “String”,
“colName”: “Key2”
},
{
“colIndex”: 3,
“colType”: “String”,
“colName”: “Key3”
},
{
“colIndex”: 4,
“colType”: “String”,
“colName”: “Key4”
},
{
“colIndex”: 5,
“colType”: “String”,
“colName”: “Key5”
},
{
“colIndex”: 6,
“colType”: “String”,
“colName”: “Key6”
},
{
“colIndex”: 7,
“colType”: “Numeric”,
“colName”: “Key7”
},
{
“colIndex”: 8,
“colType”: “Numeric”,
“colName”: “Key8”
}
]
}
Never seen this structure before. It’s a json object whi only two values: the first one looks like the values of a key:value pair, and the second one looks is an array of objects containg the description of each key value. I searched over the web trying to find similar structure with no success.Very weird.
How do I treat this object? How do I create a struct for those variables in Swift and how to parse that?
Thanks a lot!
wagmun