Im getting json with a variable array key/name. I need to use this name in the app. I have tried let keyINeed = json["venue"][0].arrayObject
but i get nil. "Meeting rooms"
and "exit"
are the values i need to populate a table but i can't hard code them as they can and will change
{ "venue": {
"name": "Home Office",
"Meeting rooms": [{
"name": "1",
}],
"exit": [{
"name": "Back door",
}]
}
}
ok, so i worked it out for anyone looking to do the same
for (key, value) in json["venue"] {
print("key \(key) value2 \(value)")
}
You should use "dictionaryValue":
so now you can do
let data = json["venue"].dictionaryValue
print(data.keys)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With