From the Server, I am receiving the below string as (AnyHashable : String)
{Type:1, OrderId:174}
I know it is not a valid Json String, but I have to deal with Type and OrderId separately
I am converting a string to JSONObject but as my string is invalid, therefore below code not converting it.
if let tag = notification.request.content.userInfo["tag"]{
if let json = try? JSONSerialization.data(withJSONObject: tag, options: []) {
// here `json` is your JSON data
print(json)
}
}
Anyone can suggest what should I do to get Type and OrderId value so I can handle the response? Or I have to convert string to json and then convert to JSONObject?