How to add extra field to php json array


(chinaka) #1

This is what i am trying to achieve:

{
“operationID”:"",
“data”: [
{
“passengerName”: “”,
“passengerAddress”: “”,
},
{
“passengerName”: “”,
“passengerAddress”: “”,
},
{
“passengerName”: “”,
“passengerAddress”: “”,
}
]
}

This is what i have currently:

{
“data”: [
{
“passengerName”: “”,
“passengerAddress”: “”,
},
{
“passengerName”: “”,
“passengerAddress”: “”,
},
{
“passengerName”: “”,
“passengerAddress”: “”,
}
]
}

So as you can see i’m trying to add the extra field “operationID”:"" before data