I am trying to get an JSON Array, which is looks like this
[
{
"number": "111-1001"
},
{
"number": "111-1002"
},
{
"number": "111-1003"
}
]
For parsing this i write this code:
let registeredNumberUrl = "http://myURL"
let url = URL(string: registeredNumberUrl)
do {
let allregisteredNumber = try Data(contentsOf: url!)
let jsonResult = try JSONSerialization.jsonObject(with: allregisteredNumber , options: []) as? [[String:Any]]
print("jsonResult \(jsonResult?.count)")
} catch let error as NSError{
print(" !!!! registered was not succeded !!!! \(error)")
}
}
But I'm getting this error:
Error Domain=NSCocoaErrorDomain
Code=3840
"No value for key in object around character 41."
UserInfo={NSDebugDescription= No value for key in object around character 41.
}
I have tried some solution like this SWIFT 2: Loop through JSON array but I'm keep getting the same error:
regNumbers.