我是使用JSON数据的新手。 我正在从Web服务读取数据。 发回的查询数据如下: [["B02001_001E","NAME","state"], ["4712651","Alabama","01"], ["691189","Alaska","02"], ["6246816","Arizona","04"], ["18511620","Florida","12"], ["9468815","Georgia","13"], ["1333591","Hawaii","15"], ["1526797","Idaho","16"], ["3762322","Puerto Rico","72"]] 有没有一种方法来反序列化这种数据的方式,基础对象将会在没有我的情况下首先定义对象是什么样子? 在上面的例子中,对象由第一行定义: ["B02001_001E","NAME","state"], 通常,Web服务将返回格式为二维JSON数组的查询数据,其中第一行提供列名称,后续行提供数据值。
我使用JSON.NET库反序列化从Facebook返回的数据有点麻烦。 从简单的墙上post返回的JSON看起来像: { "attachment":{"description":""}, "permalink":"http://www.facebook.com/permalink.php?story_fbid=123456789" } 返回的照片JSON看起来像: "attachment":{ "media":[ { "href":"http://www.facebook.com/photo.php?fbid=12345", "alt":"", "type":"photo", "src":"http://photos-b.ak.fbcdn.net/hphotos-ak-ash1/12345_s.jpg", "photo":{"aid":"1234","pid":"1234","fbid":"1234","owner":"1234","index":"12","width":"720","height":"482"}} ], 一切都很好,我没有问题。 我现在从移动客户端遇到了一个简单的贴子,使用下面的JSON,现在反序列化失败了,只有这一个post: "attachment": { "media":{}, "name":"", "caption":"", "description":"", "properties":{}, "icon":"http://www.facebook.comhttp://img.dovov.comicons/mobile_app.gif", "fb_object_type":"" }, "permalink":"http://www.facebook.com/1234" 这是我正在反序列化的类: public class FacebookAttachment { public string Name { get; set; } public string Description { get; set; } public string Href { get; set; } […]