|
发表于 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); |
|