简体   繁体   中英

json support in visual studio 2010

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 being 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM