在.NET WinForm中解析JSON [英] Parse JSON in .NET WinForm

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

问题描述

您好。我想从WebServer得到一些回复。

返回的数据如下所示:
[[3014887," string1 string","http:// num60。 webservice.com/u3014887/b_c9c0625b.jpg",0],
[3061529," string2 string"," http://num879.webservice.com/u3061529/b_320d6d36.jpg" ;, 0],
[7317649," string3 string"," http://num1233.webservice.com/u7317649/b_a60b3dc2.jpg" ;, 0],
[12851194," string4 string"," http ://num843.webservice.com/u12851194/b_4e273fa4.jpg" ;, 0],
[15819606," string5 string"," http://num9782.webservice.com/u15819606/b_66333a8f.jpg" ,0 [15947248," string6 string"," http://num1500.webservice.com/u15947248/b_920c8b64.jpg" ;, 0]]

我认为是以JSON格式,但我无法在我的.Net WinForm应用程序中解析它。

你能提供一些建议或说明如何做到吗?

我搜索了JSON.NET库, DataContractJsonSerializer类,但我无法理解如何将它们与响应的数据类型粘合在一起...

我有一个方括号。还有一个值数组,而不是我的示例中的KeyValue对。
在我的例子中使用JSON.NET是一个问题,是吗?

解决方案

我没有太多的知识JSON,但以下是一些可能帮助您解析JSON字符串的链接

http: //www.code-magazine.com/Article.aspx?quickid=090011
http://www.pozzware.com/pozzware/Corsi/Programmazione/VB.NET/JSON%20Library.aspx
http://techblog.procurios.nl/k/news/view /14605/14863/How-do-I-write-my-own-parser-for-JSON.html

Hi. I want to get some response from WebServer.

The returning data looks like this:

[[3014887,"string1 string","http://num60.webservice.com/u3014887/b_c9c0625b.jpg",0],
[3061529,"string2 string","http://num879.webservice.com/u3061529/b_320d6d36.jpg",0],
[7317649,"string3 string","http://num1233.webservice.com/u7317649/b_a60b3dc2.jpg",0],
[12851194,"string4 string","http://num843.webservice.com/u12851194/b_4e273fa4.jpg",0],
[15819606,"string5 string","http://num9782.webservice.com/u15819606/b_66333a8f.jpg",0],
[15947248,"string6 string","http://num1500.webservice.com/u15947248/b_920c8b64.jpg",0]]

I think is in the JSON format, but I couldn't parse it in my .Net WinForm application.

Can you provide some advise or exampe how to do that?

I googled about JSON.NET library, DataContractJsonSerializer class,
but I couldn't understand how to glue it all together with the response's data type...

I have a square brackets. Also there're an array of the values, not KeyValue pairs in my example.
It's a problem to use JSON.NET with my example, is it?

解决方案

I don't have much knowledge of JSON but following are some links which might help you parse JSON string

http://www.code-magazine.com/Article.aspx?quickid=090011
http://www.pozzware.com/pozzware/Corsi/Programmazione/VB.NET/JSON%20Library.aspx
http://techblog.procurios.nl/k/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html


这篇关于在.NET WinForm中解析JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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