从 JSon 转换为对象集合
下面是我的 json 字符串,我试图将其解析为我
正在使用的类的列表 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"
}
}
]
这是我的类,我希望将我的 json 解析为
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;
}
}
这是我尝试解析列表的方式,
List<GupShupTrafficAlerts> lstTrafficAlert =
JsonConvert.DeserializeObject<List<GupShupTrafficAlerts>>(@JSonString);
但是无济于事 请帮我...
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 JSON 应该如下所示:
Your JSON should look like that: