Подскажите, как можно получив массив объектов, например:
[
{
ID: 0,
NAME: "ABC",
MENU: "ABC",
ADDRESS: "#",
OWNER_ID: 0
},
{
ID: 1,
NAME: "ABC",
MENU: "AAA",
ADDRESS: "http://example.com/",
OWNER_ID: 0
},
{
ID: 2,
NAME: "ABC",
MENU: "BBB",
ADDRESS: "http://example.com/",
OWNER_ID: 0
},
{
ID: 3,
NAME: "ABC",
MENU: "CCC",
ADDRESS: "http://example.com/",
OWNER_ID: 0
},
{
ID: 4,
NAME: "ABC",
MENU: "DDD",
ADDRESS: "http://example.com/",
OWNER_ID: 0
},
{
ID: 5,
NAME: "ABC",
MENU: "EEE",
ADDRESS: "#",
OWNER_ID: 0
},
{
ID: 6,
TOOL: "ABC",
MENU: "FFF",
ADDRESS: "http://example.com/",
OWNER_ID: 5
},
{
ID: 7,
NAME: "ABC",
MENU: "GGG",
ADDRESS: "http://example.com/",
OWNER_ID: 5
},
{
ID: 8,
NAME: "ABC",
MENU: "HHH",
ADDRESS: "http://example.com/",
OWNER_ID: 5
},
{
ID: 9,
NAME: "ABC",
MENU: "III",
ADDRESS: "http://example.com/",
OWNER_ID: 5
},
{
ID: 10,
NAME: "ABC",
MENU: "JJJ",
ADDRESS: "http://example.com/",
OWNER_ID: 5
}
]
Преобразовать его массив со вложенными объектами:
[
{
"name": "ABC",
"children": [
{
"name": "AAA",
"url": "http://example.com/"
},
{
"name": "BBB",
"url": "http://example.com/"
},
{
"name": "CCC",
"url": "http://example.com/"
},
{
"name": "DDD",
"url": "http://example.com/"
},
{
"name": "EEE",
"children": [
{
"name": "FFF",
"url": "http://example.com/"
},
{
"name": "GGG",
"url": "http://example.com/"
},
{
"name": "HHH",
"url": "http://example.com/"
},
{
"name": "III",
"url": "http://example.com/"
},
{
"name": "JJJ",
"url": "http://example.com/"
}
]
}
]