У меня есть переменная JSON javascript, и я пытаюсь передать ее JSTree. Это ничего не делает.JSTree не отображает мои данные JSON из переменной JS
{
"id":1,
"data":"GDC",
"depth":-1,
"children":[
{
"id":2,
"data":"SICS",
"depth":0,
"children":[
{
"id":5,
"data":"Collaboration",
"depth":1,
"children":[
{
"id":10,
"data":"Contact Center",
"depth":2,
"children":[
{
"id":607,
"data":"Subscription",
"depth":3,
"children":[
{
"depth":4,
"id":608,
"children":[
],
"data":"Optimization"
}
]
},
{
"id":606,
"data":"Transaction",
"depth":3,
"children":[
{
"depth":4,
"id":664,
"children":[
],
"data":"Planning"
},
{
"depth":4,
"id":672,
"children":[],
}
]
}
]
},
{
"id":11,
"data":"Productivity",
"depth":2,
"children":[
{
"id":1231,
"data":"DevOps",
"depth":3,
"children":[
{
"depth":4,
"id":1280,
"children":[
],
"data":"Deployment"
}
]
},
{
"id":1229,
"data":"Tool Support",
"depth":3,
"children":[
{
"depth":4,
"id":1232,
"children":[
],
"data":"UCDT"
},
{
"depth":4,
"id":1237,
"children":[
],
"data":"PCAT"
}
]
}
]
}
]
},
{
"id":3,
"data":"Security ",
"depth":1,
"children":[
{
"id":284,
"data":"Security",
"depth":2,
"children":[
{
"id":1286,
"data":"Subscription",
"depth":3,
"children":[
{
"depth":4,
"id":1491,
"children":[
],
"data":"Software Strategy"
},
{
"depth":4,
"id":1496,
"children":[
],
"data":"Change Support/Migration"
}
]
},
{
"id":1285,
"data":"Transaction",
"depth":3,
"children":[
{
"depth":4,
"id":1287,
"children":[
],
"data":"CRD"
},
{
"depth":4,
"id":1290,
"children":[
],
"data":"NIP"
}
]
}
]
}
]
}
]
}
]
}
Ive подал эти данные в JSTree, но не сделал ничего. Я пробовал использовать базовые данные JSON, но это требует. Когда у меня есть вложенные дети, это, кажется, терпит неудачу.
-й код JS является:
$(function() {
$('#jstree').jstree({
'json_data' : {
'data' : data
}
});
});
Любые идеи?
Обеспечить демонстрацию, которая воспроизводит проблему. Следует изменить 'data' на' text' на docs – charlietfl
Возможный дубликат [Загрузка Json as variable в jsTree] (http://stackoverflow.com/questions/29498426/loading-json-as-variable-into-jstree) – Saadi
Пожалуйста включают код JavaScript/jQuery, который вы используете с jsTree для рендеринга данных JSON. Проблема может быть в коде больше, чем в данных. – JohnH