I need this result in PHP:
$pass->setJSON('{
"formatVersion" : 1,
"description" : "title",
"coupon" : {
"primaryFields" : [
{
"key" : "offer",
"label" : "title",
"value" : "50%"
}
],
}
}');
I try to build this with arrays:
$jsonpost = array();
$jsonpost['formatVersion'] = '1';
$jsonpost['description'] = "test";
And then convert with JSON_ENCODE:
$json = json_encode($jsonpost);
$pass->setJSON($json);
How do I set the multi level array (coupons) in PHP?