I am trying to parse the JSON which is getting from server response. But I'm unable to parse, the JSON getting error.
This is my code:
let data = Data(message.utf8)
do {
let jsonDict = try JSONSerialization.jsonObject(with: data,options: .allowFragments) as? NSDictionary
print(jsonDict)
} catch let error as NSError {
print("Failed to load: \(error.localizedDescription)")
}
This response I'm getting from server:
{
"requestId": "123",
"success": true,
"body": {
"expirydate": "10/11/2020",
"gsm": "9988776655",
"pass": "123456",
"registerdate": "10/10/2020",
"type": "paid",
"typeofsubscription": "30days",
"username": "aryan"
}
}
Please help me out. Thank you