Having problems calling my parent Title ("Main title") in my JSON object. Below is a fiddle with what I currently have. (I can get it to call all child nodes in items, but again need to figure out how to call "title: Main Title")
在JSON对象中调用父标题(“Main Title”)有问题。下面是对我目前所拥有的东西的一种曲解。(我可以让它调用项目中的所有子节点,但同样需要弄清楚如何调用“title: Main title”)
http://jsfiddle.net/VVAFM/3/
Current JSON Tree
当前JSON树
{
"title": "Main Title",
"items": [{
"title": "Sub Title 1 "
},
{
"title": "Sub Title 2",
"items": [{
"title": "Sub Item 1"
},
{
"title": "Sub Item 2"
}]
},
{
"title": "Sub Title 3",
"items": [{
"title": "Sub Item 1"
},
{
"title": "Sub Item 2"
}]
},
{
"title": "Sub Title 4 "
}]
}
1 个解决方案
#1
2
you can try the new JSON SELECT engine, looks interesting and affords CSS-like select statements over your JSON.
您可以尝试新的JSON选择引擎,看起来很有趣,并且可以在JSON中提供类似csslike的选择语句。
http://jsonselect.org/#overview
http://jsonselect.org/概述
having said that, you can reference it differently like so: http://jsfiddle.net/dimitar/VVAFM/4/
说到这里,您可以以不同的方式引用它:http://jsfiddle.net/dimitar/vafm/4/
the title var will refer to main title, always.
标题var总是指向主标题。
good luck :)
祝你好运:)
#1
2
you can try the new JSON SELECT engine, looks interesting and affords CSS-like select statements over your JSON.
您可以尝试新的JSON选择引擎,看起来很有趣,并且可以在JSON中提供类似csslike的选择语句。
http://jsonselect.org/#overview
http://jsonselect.org/概述
having said that, you can reference it differently like so: http://jsfiddle.net/dimitar/VVAFM/4/
说到这里,您可以以不同的方式引用它:http://jsfiddle.net/dimitar/vafm/4/
the title var will refer to main title, always.
标题var总是指向主标题。
good luck :)
祝你好运:)