http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 3574|回复: 3

[Winform] 两个问题,Json 解析成 List

[复制链接]
发表于 2015-2-14 19:36:51 | 显示全部楼层 |阅读模式
第一个问题

如何把Json 解析成 List

怎么写


第二个问题


content:[{ wordID: 26297, word: \"A\", mean: \"a.一,一个,一只,一件.\", phonetic: \"2eI,E3\", example: \"<i>1.</i> I don't care what <font color=#cc0066>a</font> car looks like as long as it gets me from <font color=#cc0066>A</font> to B.<br>&nbsp;&nbsp; <font color=#223322>我倒不在乎汽车的样子, 只要能把我从一处载到另一处就行了.<br></font><i>2.</i> Would you do me <font color=#cc0066>a</font> favor?<br>&nbsp;&nbsp; <font color=#223322>你能帮我一个忙吗?<br></font>\", picture: \"Attachments/Images/A.png\" },{ wordID: 26297, word: \"A\", mean: \"a.一,一个,一只,一件.\", phonetic: \"2eI,E3\", example: \"<i>1.</i> I don't care what <font color=#cc0066>a</font> car looks like as long as it gets me from <font color=#cc0066>A</font> to B.<br>&nbsp;&nbsp; <font color=#223322>我倒不在乎汽车的样子, 只要能把我从一处载到另一处就行了.<br></font><i>2.</i> Would you do me <font color=#cc0066>a</font> favor?<br>&nbsp;&nbsp; <font color=#223322>你能帮我一个忙吗?<br></font>\", picture: \"Attachments/Images/A.png\" },{ wordID: 26297, word: \"A\", mean: \"a.一,一个,一只,一件.\", phonetic: \"2eI,E3\", example: \"<i>1.</i> I don't care what <font color=#cc0066>a</font> car looks like as long as it gets me from <font color=#cc0066>A</font> to B.<br>&nbsp;&nbsp; <font color=#223322>我倒不在乎汽车的样子, 只要能把我从一处载到另一处就行了.<br></font><i>2.</i> Would you do me <font color=#cc0066>a</font> favor?<br>&nbsp;&nbsp; <font color=#223322>你能帮我一个忙吗?<br></font>\", picture: \"Attachments/Images/A.png\" }]
怎么得到content:下有多少个数组,没办法用,号,mean里有的时候有,号,


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2015-2-15 10:03:42 | 显示全部楼层
可否提供一个完整的json ? 给你个参考
{
    "title": "title",
    "background": {},
    "design_width": 720,
    "design_height": 1137,
    "sys_loader": {},
    "user_loader": {
        "elements": [
            {
                "x": 0,
                "y": 0,
                "w": 360,
                "h": 1137,
                "animal": {
                    "in": {},
                    "condition": {},
                    "out": {
                        "function": "flyInto",
                        "dir": "left",
                        "time": 1,
                        "reverse": 1
                    }
                },
                "content": {
                    "type": "image",
                    "src": "image/leftDoor.jpg"
                }
            },
            {
                "x": 360,
                "y": 0,
                "w": 360,
                "h": 1137,
                "animal": {
                    "in": {},
                    "condition": {},
                    "out": {
                        "function": "flyInto",
                        "dir": "right",
                        "time": 1,
                        "reverse": 1
                    }
                },
                "content": {
                    "type": "image",
                    "src": "image/rightDoor.jpg"
                }
            }
        ]
    },
    "viewportfixtype": "minfix",
    "global_element": {
        "music_toggle": {
            "x": 566,
            "y": 10,
            "w": 64,
            "h": 64,
            "content": {
                "play_src": "image/playicon.png",
                "pause_src": "image/pauseicon.png",
                "music_url": "music/bgmusic.mp3"
            }
        },
        "flip_button": {
            "x": 343,
            "y": 1060,
            "w": 35,
            "h": 32,
            "content": {
                "src": "image/nextpageicon.png"
            }
        },
        "page_indicator": {
            "x": 30,
            "y": 10,
            "w": 114,
            "h": 682,
            "content": {
                "src": "image/time2.png"
            }
        }
    },
    "touchway": "horizo123ntal",
    "page_stack": {
        "pagechangeanimal": "pca106_v",
        "pages": [
            {
                "background": {
                    "image": "url(image/page1_bg.jpg)"
                },
                "elements": [
                    {
                        "x": 53,
                        "y": 600,
                        "w": 614,
                        "h": 285,
                        "animal": {
                            "in": {
                                "function": "float",
                                "time": 1
                            },
                            "condition": {
                                "function": "rotate3d",
                                "time": 1
                            },
                            "out": {
                                "function": "farToNear",
                                "time": 1,
                                "reverse": 1
                            }
                        },
                        "content": {
                            "type": "image",
                            "src": "image/page1_e1.png"
                        }
                    }
                ]
            },
            {
                "background": {
                    "image": "url(image/page2_bg.jpg)"
                },
                "elements": [
                    {
                        "x": 14,
                        "y": 756,
                        "w": 692,
                        "h": 756,
                        "animal": {
                            "in": {
                                "function": "rotate3d",
                                "time": 1
                            },
                            "condition": {
                                "function": "rotate3d",
                                "time": 1
                            },
                            "out": {
                                "function": "glide",
                                "time": 1,
                                "reverse": 1
                            }
                        },
                        "content": {
                            "type": "component.album_01",
                            "imgs": [
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                },
                                {
                                    "icon": "image/loading_icon1.png",
                                    "bg": "image/loading_icon2.png"
                                }
                            ],
                            "imgW": 100,
                            "imgH": 100
                        }
                    }
                ]
            }
        ]
    }
}
我这里是获取imgs下数组的长度。

string json = File.ReadAllText("data.js");
            JObject obj = JObject.Parse(json);
            JToken o1 = obj["page_stack"]["pages"][1]["elements"][0]["content"]["imgs"];
            JArray ja = (JArray)o1;


            Console.WriteLine(ja.Count);
发表于 2015-2-15 10:32:14 | 显示全部楼层
我只是路过打酱油的。
 楼主| 发表于 2015-2-15 16:32:49 | 显示全部楼层
感觉二楼,问题解决,
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-6-13 15:39

© 2014-2021

快速回复 返回顶部 返回列表