Below is my json string, which i am trying to parse to list of my class
i am using NewtonsJson.net.3.5
[
{
"message": {
"$": "@12:55 Big Rally on South Bound of Dr. B.A. Road. Motorists may use RAK Road, P. D'Melow Road & A.B. Road for CST.\n -visit icicilombard.com"
},
"picture": {
"$": ""
},
"medium": {
"$": "API"
},
"timestamp": {
"$": "03\/15\/2011 12:55:42 IST"
}
}
]
This is my class of which i want my json to be parsed to
public class GupShupTrafficAlerts
{
private string _message = string.Empty;
private string _picture = string.Empty;
private string _medium = string.Empty;
private string _timeStamp = string.Empty;
public String message
{
get;
set;
}
public string timestamp
{
get;
set;
}
public string medium
{
get;
set;
}
public string picture
{
get;
set;
}
}
this is the way i m trying to parse to List
List<GupShupTrafficAlerts> lstTrafficAlert =
JsonConvert.DeserializeObject<List<GupShupTrafficAlerts>>(@JSonString);
but to no avail Please help me...
Your JSON should look like that:
[
{
"message": "@12:55 Big Rally on South Bound of Dr. B.A. Road. Motorists may use RAK Road, P. D'Melow Road & A.B. Road for CST.\n -visit icicilombard.com",
"picture": "",
"medium": "API",
"timestamp":"03\/15\/2011 12:55:42 IST"
}
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With