From the below json data how can I check if key "type_1" of "no_2" exists, if doesnt exists to push {"p_id": "24","subcat_id": "2","name": "ok"}
to the "type_1" of "no_2" array object.
How does key index and array push works here
{
"no_1": {
"orderNumber": "no_1",
"billing_order_id": "1",
"orderArray": {
"type 2": [
{
"p_id": "25",
"subcat_id": "2",
"name": "fine"
},
{
"p_id": "34",
"subcat_id": "2",
"name": "not ok"
}
]
}
},
"no_2": {
"orderNumber": "no_2",
"billing_order_id": "1",
"orderArray": {
"type_1": [
{
"p_id": "6",
"subcat_id": "1",
"name": "hello"
}
]
}
}
}