I own an object containing several arrays within it. And these arrays contain other objects that contain a lpec_sequence
field that I would like under each hierarchy to be sorted by that field. And I would like to go through each sub-menu inside the objects and sort them as well.
{
"layout": {
"menu_events": [
{
"lpec_id": 90,
"lpec_sequence": 1,
"sub_menu": false
},
{
"lpec_id": 125,
"lpec_sequence": 2,
"sub_menu": false
},
{
"lpec_id": 124,
"lpec_sequence": 3,
"sub_menu": true,
"sub_menu_items": [
{
"lpec_id": 96,
"lpec_sequence": 5,
"sub_menu": false
},
{
"lpec_id": 97,
"lpec_sequence": 6,
"sub_menu": false
},
{
"lpec_id": 98,
"lpec_sequence": 7,
"sub_menu": false
},
{
"lpec_id": 99,
"lpec_sequence": 8,
"sub_menu": true,
"sub_menu_items": [
{
"lpec_id": 100,
"lpec_sequence": 1,
"sub_menu": false
},
{
"lpec_id": 101,
"lpec_sequence": 2,
"sub_menu": false
},
{
"lpec_id": 102,
"lpec_sequence": 3,
"sub_menu": false
},
{
"lpec_id": 103,
"lpec_sequence": 4,
"sub_menu": false
},
{
"lpec_id": 104,
"lpec_sequence": 5,
"sub_menu": false
},
{
"lpec_id": 105,
"lpec_sequence": 6,
"sub_menu": false
},
{
"lpec_id": 106,
"lpec_sequence": 7,
"sub_menu": false
}
]
},
{
"lpec_id": 118,
"lpec_sequence": 10,
"sub_menu": true,
"sub_menu_items": [
{
"lpec_id": 121,
"lpec_sequence": 3,
"sub_menu": false
},
{
"lpec_id": 122,
"lpec_sequence": 4,
"sub_menu": false
},
{
"lpec_id": 119,
"lpec_sequence": 1,
"sub_menu": false
},
{
"lpec_id": 120,
"lpec_sequence": 2,
"sub_menu": false
}
]
},
{
"lpec_id": 92,
"lpec_sequence": 1,
"sub_menu": false
},
{
"lpec_id": 93,
"lpec_sequence": 2,
"sub_menu": false
},
{
"lpec_id": 94,
"lpec_sequence": 3,
"sub_menu": false
},
{
"lpec_id": 95,
"lpec_sequence": 4,
"sub_menu": false
},
{
"lpec_id": 107,
"lpec_sequence": 9,
"sub_menu": true,
"sub_menu_items": [
{
"lpec_id": 109,
"lpec_sequence": 2,
"sub_menu": false
},
{
"lpec_id": 110,
"lpec_sequence": 3,
"sub_menu": false
},
{
"lpec_id": 111,
"lpec_sequence": 4,
"sub_menu": false
},
{
"lpec_id": 112,
"lpec_sequence": 5,
"sub_menu": false
},
{
"lpec_id": 114,
"lpec_sequence": 7,
"sub_menu": false
},
{
"lpec_id": 113,
"lpec_sequence": 6,
"sub_menu": false
},
{
"lpec_id": 115,
"lpec_sequence": 8,
"sub_menu": false
},
{
"lpec_id": 116,
"lpec_sequence": 9,
"sub_menu": false
},
{
"lpec_id": 117,
"lpec_sequence": 10,
"sub_menu": false
},
{
"lpec_id": 108,
"lpec_sequence": 1,
"sub_menu": false
}
]
}
]
},
{
"lpec_id": 123,
"lpec_sequence": 2,
"sub_menu": true,
"sub_menu_items": [
{
"lpec_id": 91,
"lpec_sequence": 1,
"sub_menu": false
}
]
}
]
}
}