I need to build a http_request raw json in drupal 7
and the format of the json is:
{"customerAddress":
{
"address":"foo st",
"town":"Roma",
"postalCode":"00131",
"district":"RM"
},
"products": [{"nmuId":"SOME-ID"}],
"business_type": "LEAD"}
this is the code in my custom module
$url = API_HOST;
$indirizzo = array (
'address' => $address,
'town' => $city,
'postalCode' => $cap,