قالب وردپرس درنا توس
Home / IOS Development / json – Alamofire in iOS receives dictionary instead of Array

json – Alamofire in iOS receives dictionary instead of Array



I'm working on creating tables in iOS and will probably receive the necessary data in the form of JSON matrices. However, when I get the data in my iOS app, it is presented as an unsorted dictionary instead. I was able to run the GET request in Postman and receive the data correctly, but when I receive them through Alamofire in my iOS app, they are not formatted properly. Is it possible for Alamofire to somehow reformat JSON and convert all matrices to dictionaries, and can I override that setting in some way?

Here is an example of JSON's column section in Postman:

 enter image description here

And here's what I receive through Alamofire:

 enter image description here

How do I try to access JSON

  if let jsonColumns = json ["columns"] as? [[String:Any]] {
for columns in jsonColumns {
for column in columns.values ​​{
if let c = column like? [String:Any] {
if c ["isVisible"] as? Bool == false {
Continue
}
if la columnName = c ["name"] as? String {
dataSet.columns.append (Column)
}
}
}
}
}


Source link