PHP JSon Como ler valor booleano recebido no formato JSon e escrever em string no PHP
Eu recebo esta string JSON de outro site e não consigo modificar o que recebeu. A string é recebida em $ _POST e é:
[
{
"clientId":"17295c59-4373-655a-1141-994aec1779dc",
"channel":"\/meta\/connect",
"connectionType":"long-polling",
"ext":{
"fm.ack":false,
"fm.sessionId":"22b0bdcf-4a35-62fc-3764-db4caeece44b"
},
"id":"5"
}
]
Eu decodifico a string JSON com o seguinte código:
$receive = json_decode(file_get_contents('php://input'));
E quando eu usoprint_r($receive)
Eu recebo o seguinte:
Array (
[0] => stdClass Object
(
[clientId] => 17295c59-4373-655a-1141-994aec1779dc
[channel] => /meta/connect
[connectionType] => long-polling
[ext] => stdClass Object
(
[fm.ack] =>
[fm.sessionId] => 22b0bdcf-4a35-62fc-3764-db4caeece44b
)
[id] => 5
)
)
Eu posso acessar e ler todos os Array / Object sem problemas:
$receive[$i]->clientId;
$receive[$i]->channel;
$connectionType = $receive[$i]->connectionType;
$receive[$i]->id;
$receive[$i]->ext->{'fm.sessionId'};
Mas {fm.ack} está vazio
Na string JSON decodificada, o valor falso não está entre""
.
É possível acessar e ler o valor falso e convertê-lo em valor de string?
Obrigado pela sua ajuda!