When working with a JSON data structure containing 100 objects, the output will resemble the following:
[{
"Value": "Sens1_001",
"Parent": Null,
"Child": {
"Value": "Sens2_068",
"Parent":"Sens1_001",
"Child" : {
"Value": "Sens3_034",
"Parent": "Sen2_068",
"Child": null,
"z_cordinate": 5
},
"z_cordinate": 0
},
"z_cordonate": -5
},
{
"Value": "Sens1_002",
"Parent": Null,
"Child": {
"Value": "Sens2_037",
"Parent":"Sens1_002",
"Child" : {
"Value": "Sens3_099",
"Parent": "Sen2_037",
"Child": null,
"z_cordinate": 5
},
"z_cordinate": 0
},
"z_cordonate": -5
},
{
"Value": "Sens1_003",
"Parent": Null,
"Child": {
"Value": "Sens2_012",
"Parent":"Sens1_003",
"Child" : {
"Value": "Sens3_054",
"Parent": "Sen2_012",
"Child": null,
"z_cordinate": 5
},
"z_cordinate": 0
},
"z_cordonate": -5
},
.
.
. // until the 100th object
{
"Value": "Sens1_100",
"Parent": Null,
"Child": {
"Value": "Sens2_001",
"Parent":"Sens1_100",
"Child" : {
"Value": "Sens3_021",
"Parent": "Sen2_001",
"Child": null,
"z_cordinate": 5
},
"z_cordinate": 0
},
"z_cordonate": -5
}]
PLEASE NOTE: I have modified the appearance of the objects to look more like an array rather than individual objects. While JSON is important, the array format better serves my purpose.
Objective:
I am looking for guidance on how to access the objects in a X.parent.child hierarchy. I have some understanding but need assistance in structuring this object properly. Additionally, I intend to access the objects in both directions, from Grandparent to Parent to Child and from Me to Parent to Grandparent. It's crucial that the parent-child relationships are logical and not random, especially since a parent can have multiple children.