开发者

json support in visual studio 2010

开发者 https://www.devze.com 2022-12-30 03:45 出处:网络
I\'m trying to work on a new project parsing some JSON data for a Silverlight 4 project (specifically created as a \"Silverlight Business Application - Visual C#\" project) using C# in Visual Studio 2

I'm trying to work on a new project parsing some JSON data for a Silverlight 4 project (specifically created as a "Silverlight Business Application - Visual C#" project) using C# in Visual Studio 2010, and I can't find how to include the references to have parsers and native object support for JSON data.

As far as I know my development tools are up to date (checked MS update).

I know that I can probably just write my own parser but that seems like re-inventing the wheel. Below are some lines that work in VS 2008 in another project of ours (can't post the files due to their bei开发者_C百科ng part of a business app):

using System.Json;

results = (JsonObject)JsonObject.Load(e.Result);

I hope my description is adequate.

Thanks for looking,

jnsohnumr


I use System.Web.Script.Serialization.JavaScriptSerializer

However, since it does not work in Visual Studio 2010 without configuration, you'll have to figure out how to make it work yourself.


I've been using Json.Net. (http://james.newtonking.com/pages/json-net.aspx) to serialize.

[Update: http://json.codeplex.com/ for latest version]

[Update Sept 27 2017: https://github.com/JamesNK/Newtonsoft.Json latest version no longer works in visual studio 2010]


Here you can find a very well-written open-source solution for parsing JSON data:
http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html

It is not native, but I have used it recently and did the job...


Add a reference to System.Json. Add a reference to System.Json. I just did it and now my using statement is working fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号