Find one-dimensional array to multi-dimensional array urgent!

{level: "1", name: "0", pId: "0", id: "ADD25006"}
1: {level: "1", name: "Unit 1", pId: "0", id: "ADD25001"}
2: {level: "1", name: "Unit 2", pId: "0", id: "ADD25003"}
3: {level: "1", name: "Unit 3", pId: "0" Id: "ADD25008"}
4: {level: "1", name: "Unit 4", pId: "0", id: "ADD25005"}
5: {level: "1", name: "Unit 8", pId: "0", id: "ADD25007"}
6: {level: "1", name: "Unit 9", pId: "0", id: "ADD25002"}
7: {level: "3" Name: "AAAGH hot water return ditch", pId: "ADD250011", id: "ADD250030"}
8: {level: "2", name: "BOP plant and structure", pId: "ADD25003", id: "ADD250013"}
9: {level: "2", name: "BOP plant and structure", pId: "ADD25001", id: "ADD250011"}
10: {level: "3", name: "CB intake tunnel", pId: "ADD250011" Id: "ADD250026"}
11: {level: "3", name: "DX diesel generator plant", pId: "ADD250010", id: "ADD250015"}
12: {level: "3", name: "DZ diesel engine room", pId: "ADD250010", id: "ADD250025"}
13: {level: "3", name: "ET shutdown locker room", pId: "ADD250010", id: "ADD250016"}
14: {level: "3" Name: "EU tower", pId: "ADD250010", id: "ADD250024"}
15: {level: "3", name: "FF turbine accident oil discharge pit", pId: "ADD250011", id: "ADD250027"}
16: {level: "3", name: "GA plant water intake corridor", pId: "ADD250011", id: "ADD250028"}
17: {level: "3", name: "GD circulating water in and out of pipe ditch" PId: "ADD250011", id: "ADD250029"}
18: {level: "3", name: "GS important factory water drainage tank ", pId: "ADD250011", id: "ADD250031"}
19: {level: "3", name: "KX nuclear fuel plant", pId: "ADD250010", id: "ADD250022"}
20: {level: "3", name: "LX electrical plant", pId: "ADD250010" Id: "ADD250023"}
21: {level: "3", name: "NX Nuclear Auxiliary Plant", pId: "ADD250010", id: "ADD250021"}
22: {level: "3", name: "RE Auxiliary Water supply Tank Room", pId: "ADD250010", id: "ADD250017"}
23: {level: "3", name: "RP reactor Building Gantry", pId: "ADD250010" Id: "ADD250020"}
24: {level: "3", name: "RX reactor Building", pId: "ADD250010", id: "ADD250019"}
25: {level: "3", name: "WX connection Plant", pId: "ADD250010", id: "ADD250018"}
26: {level: "2", name: "conventional Island Plant and structure", pId: "ADD25003", id: "ADD250012"}
27: {level: "2" Name: "conventional Island Plant and structure", pId: "ADD25001", id: "ADD25009"}
28: {level: "2", name: "Nuclear Island Plant and structure", pId: "ADD25003", id: "ADD250014"}
29: {level: "2", name: "Nuclear Island Plant and structure", pId: "ADD25001", id: "ADD250010"}
30: {level: "1", name: "other" PId: "0", id: "ADD25004"}

if the above data is converted to a multi-dimensional array format, level = 1 is the first level, the second level is the first level, the id of the first level is matched with the pId of level = 2, and the third level is the Id of the second level and the pId of level = 3. Ask for help.

May.20,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e861b4-45af5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e861b4-45af5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?