asp.net如何解析json字符串?
把字符串传给c#服务器端,大概格式如下所示:{"0":{"gold":"5","name":"a","silver":"c"},"1":{"gold":"0","name...
把字符串传给c#服务器端,大概格式如下所示: {"0":{"gold":"5","name":"a","silver":"c"},"1":{"gold":"0","name":"b","silver":"d"}} 请问如何在c#中把这段json字符串解析成对象数组,或者对象集合??
展开
2个回答
展开全部
javascript 解析用
var data = eval(json) ; 数组
c#解析用:
using System.Web.Extensions;
using System.Web.Script.Serialization;
public object FromJson(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
var data = eval(json) ; 数组
c#解析用:
using System.Web.Extensions;
using System.Web.Script.Serialization;
public object FromJson(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询