开发者

JSON and C# System.Web.Script.Serialization.JavaScriptSerializer alternative

开发者 https://www.devze.com 2023-03-17 15:19 出处:网络
I was using JavaScriptSerializer to handle JSON serialization, but because of some unforeseen problems (my bad luck) I have to use something else.

I was using JavaScriptSerializer to handle JSON serialization, but because of some unforeseen problems (my bad luck) I have to use something else.

All I need from serializer looks lie this:

string json = "..."
JavaScriptSerializer ser = new JavaScriptSerializer();
Dictionary<string, Object> o = ser.Deseria开发者_开发百科lize<Dictionary<string, Object>>(json);

So I end up with a dictionary that contains other dictionaries/arrays/objects that represents json hierarchical structure. I already have a code that does some analysis on data structured like that, and I don't want to change that part.

Which JSON parser for C# can provide such functionality?


you can use json.net or fastjson opensource libraries to perform this task in a faster and more efficient way than using the built in .net serializer.

json.net - http://json.codeplex.com/

fastJson - http://www.codeproject.com/Articles/159450/fastJSON

0

精彩评论

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

关注公众号