Reputation: 7625
I don't know any PHP but i need to get my JSON object to look a certain way
$body['aps'] = array(
'alert' => "look at this stuff",
'sound' => 'default'
);
$payload = json_encode($body);
How can I make the JSON object look like
{
"aps":
{
"alert": "look at this stuff",
"sound": 'default'
},
"view": "wc1"
}
Upvotes: 0
Views: 33
Reputation: 31006
Are you trying to insert another value into $body
?
$body['aps'] = array(
'alert' => "look at this stuff",
'sound' => 'default'
);
$body['view'] = 'wc1';
$payload = json_encode($body);
Upvotes: 4