I am doing an api to do the integration of two different systems, the system sends me the following json:
cJson = [{"TESTE": "1"}]
I was 3 days with a problem because I was not able to get the json that the other system sent me via post with neither of the two methods below:
$dados = $request->getBody();
$dados = $request->getParsedBody();
I solved this problem and now I can get the json that the other system sends me with the following method:
$dados = (string) $resquest->getBody();
But this method just above returns a string, and I need to turn it into array or object to insert it into the database. when I echo what is returned to me is just what I want to see just below:
echo $dados;
resultado: [{"TESTE": "1"}]
But when I use a json_decode it does not return anything returns null, example:
echo json_decode($dados);
resultado: null
Would it be a string? Is there any way I could work it out? I already have the data but I can not manipulate it to insert into the database ...