I have a JSON with the following structure:
{
"content": [
{
"id": 119273908,
"numeroPeca": "0008919712005802000110000125",
},
{
"id": 25926466,
"numeroPeca": "0500013942009802003310000126",
},
{
"id": 124435361,
"numeroPeca": "0800040772017802001510000124",
},
{
"id": 79760181,
"numeroPeca": "0066239062010802000110000118",
}
],
"last": false,
"totalElements": 6402,
"totalPages": 4,
"size": 2000,
"number": 0,
"sort": null,
"first": true,
"numberOfElements": 2000
}
I would like to capture the "totalPages" field
my partial code (PHP):
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
$array = json_decode($response, true);
echo $array['content'];
}
However, the answer is:
Notice: Array to string conversion in C:\xampp\htdocs\acre.php on line 39 Array