$data = array(
'uid' => 'key',
'zip' => 'STRING_VARIABLE',
"school" => array(
array("sid" => "STRING_VARIABLE", "qty" => NUMERIC_VARIABLE),
array("strSrchSchool" => array(
"name" => "STRING_VARIABLE",
"address" => "STRING_VARIABLE",
),
"students" => NUMERIC_VARIABLE)
),
"sort" => "default"
);
Above array is a part of API call. I want dynamic values at places where I have mentioned 'STRING_VARIABLE' & 'NUMERIC_VARIABLE'. So I want to write PHP variables there and tried few different things of concatenation but none is working.
When I call API With different tries for above PHP variables, it gives below error.
array(2) { ["status"]=> string(5) "error" ["error"]=> string(62) "Error parsing JSON object, check format and object definition." }
So please let me know what is correct method to write PHP variable directly at above mentioned places when creating PHP array.
json_decode()(if you are receiving data) or ajson_encodeif you are passing it. You can try adding a$data = json_encode()data after your array definition and seeing if that helps, but I would need more context to provide a proper answer otherwise.