将 JSON 对象解析为 C# [英] Parsing JSON objects to c#

查看:36
本文介绍了将 JSON 对象解析为 C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此链接中的示例http://sharp.devpt.com/2009/10/deserialize-json-on-c.html?showComment=1265045828773#c2497312518008004159

I am trying to use the example in this link http://sharpdevpt.blogspot.com/2009/10/deserialize-json-on-c.html?showComment=1265045828773#c2497312518008004159

但是我的项目不会使用 JavaScriptConvert.DeserializeObject 进行编译,示例说这是来自 .net 库,有谁知道是哪一个?

But my project wont compile using JavaScriptConvert.DeserializeObject, the example says this is from a .net library does anyone know which one?

我知道下面的例子使用 Newtonsoft.Json....

I know the example below uses Newtonsoft.Json....

推荐答案

关于反序列化的简单方法http://blogs.msdn.com/rakkimk/archive/2009/01/30/asp-net-json-serialization-and-deserialization.aspx

For a simple way to deserialize http://blogs.msdn.com/rakkimk/archive/2009/01/30/asp-net-json-serialization-and-deserialization.aspx

JavaScriptSerializer js = new JavaScriptSerializer();
Person p2 = js.Deserialize<classtype>(str);

这篇关于将 JSON 对象解析为 C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆