当前位置:编程学习 > C#/ASP.NET >>

WP7中解析json中的数组,怎么把json里的数据转为数组

"categories":[
                  {
                  "category": "111",
                  "items":[
                            {"name": "0","number": ["000"],"image_url":"","html_url":""},
                            {"name": "1","number": ["111"],"image_url":"","html_url":""},
                            {"name": "2","number": ["222"],"image_url":"","html_url":""},
                            {"name": "3","number": ["333"],"image_url":"","html_url":""}
                            ]
                  }

例如这个:items是一个数组 怎么把它转为数组解析出来。。。或者怎样才能获取到json里面items数组的长度 --------------------编程问答--------------------

var x={"categories":[
  {
  "category": "111",
  "items":[
  {"name": "0","number": ["000"],"image_url":"","html_url":""},
  {"name": "1","number": ["111"],"image_url":"","html_url":""},
  {"name": "2","number": ["222"],"image_url":"","html_url":""},
  {"name": "3","number": ["333"],"image_url":"","html_url":""}
  ]
  }]};
  alert(x.categories[0].items.length);
--------------------编程问答-------------------- 你好 我是想用C#的 来解析 不要用JS的 能写C#的吗 --------------------编程问答-------------------- 你首先要定义一个用来承载解析结果的实体class,然后就直接调用语句反序列化代码就行了。 --------------------编程问答-------------------- 各位我已经自己搞定了 麻烦了 谢谢 --------------------编程问答--------------------
引用 4 楼  的回复:
各位我已经自己搞定了 麻烦了 谢谢
恭喜+jf~
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,