asp.net怎么做json数据接口
像http://api.map.baidu.com/telematics/v3/weather?location=%E8%A1%A1%E9%98%B3&output=js...
像http://api.map.baidu.com/telematics/v3/weather?location=%E8%A1%A1%E9%98%B3&output=json&ak=rnm8udmHdWaHFWZTO2tuTiG8&qq-pf-to=pcqq.c2c这样的 然后我外部用json跨域获取数据
展开
1个回答
展开全部
//序列化为Json返回
User user = new User {Name = "jquery", Age = 20};
JavaScriptSerializer serializer = new JavaScriptSerializer();
string result = serializer.Serialize(user);
Reponse.write(result);
///反序列化
String input = "";
JavaScriptSerializer serializer = new JavaScriptSerializer();
serializer.Deserialize<User>(input);
在.net 的这个命名控件下 System.Web.Script.Serialization;
给你在发个链接:http://www.cnblogs.com/liuhh/articles/1782923.html
Good Luck!希望能够帮助到你!
如果帮助到你,请采纳!谢谢!
User user = new User {Name = "jquery", Age = 20};
JavaScriptSerializer serializer = new JavaScriptSerializer();
string result = serializer.Serialize(user);
Reponse.write(result);
///反序列化
String input = "";
JavaScriptSerializer serializer = new JavaScriptSerializer();
serializer.Deserialize<User>(input);
在.net 的这个命名控件下 System.Web.Script.Serialization;
给你在发个链接:http://www.cnblogs.com/liuhh/articles/1782923.html
Good Luck!希望能够帮助到你!
如果帮助到你,请采纳!谢谢!
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询