Tree icons

example json

{ id: “1”, value: “one”, open: true, “icon”: “help.gif”, key: “_2”, data: [
{
id: 2,
value: “house”,
data: [
{
id: 3,
value: “house2”,
“icon”: “help.gif”,
data: [
{
id: 4,
value: “house3”,
data: [
{
id: 5,
value: “house4”,
“icon”: “help.gif”,
data: [
{
id: 6,
value: “result”,
“icon”: “idea.gif”,
“key”: “_7”
},
at the "id: 6 " there is still key field
how to set the icon of the field “icon” only for branches that have the field “key”

how to replace the icon at the branch that does not have a other branches?

closed