Following is my notification body:
{
"to" : "My device FCM Token",
"notification" :
{
"body" : "Hi....",
"title": "Test"
},
"data" :
{
"commentMessageType": "support",
"requestData":
{
"request": {
"itemId": 3462,
"itemTitle": "Request for books",
"itemDescription": "Request for books",
},
"category": "Books",
"companyId": 74366,
"companyName": "manish thomas-Furniture Mart hub",
"location": {
"locationId": 0,
"locationName": null,
"blogCollectionId": 0,
"fileUrl": null
},
"lockedLocation": null,
"itemRequesterName": "Albee "
}
}
}
I can read the `requestData` like below in ios platform:
var myData = JsonConvert.DeserializeObject<RequestList>(userInfo[new NSString("requestData")] as NSString);
But when I try to read the `commentMessageType` like below I am getting `Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: s. Path '', line 1, position 1.`.
var commentType = JsonConvert.DeserializeObject<String>(userInfo[new NSString("commentMessageType")] as NSString);
I tried another way like below, but I got `System.NullReferenceException: Object reference not set to an instance of an object`.
NSDictionary data = userInfo.ObjectForKey(new NSString("data")) as NSDictionary;
string commentType = Convert.ToString(data[new NSString("commentMessageType")] as NSString);
What is the exact way to parse a string data from notification?