Can anyone help me to get the answer…
Try something like this:
import Foundation
// set up the data, taken from your SO question...
let jsonRaw = """
{
"name": "Arun",
"age": "12",
"Address": [
{
"house_name": "xxxx",
"street": "xxxx",
"district": "xxxx",
"state": "xxxxx"
},
{
"house_name": "xxxx",
"street": "xxxx",
"district": "xxxx",
"state": "xxxxx"
}
]
}
"""
// convert JSON data into [String:Any]
let data = Data(jsonRaw.utf8)
let json = try? JSONSerialization.jsonObject(with: data, options: [])
print(json!)
Thanks for the reply. But when passing this as parameters in alamofire , found some error like invalid format. Why this happens?