I'm trying to convert a json string into an array with php.
My php version is 7.0
I'm getting this error:
PHP Fatal error: Uncaught Error: Call to undefined function GuzzleHttp\json_decode()
Here's the code with the issue:
$adjunto1 = $value['archivo'];
$adjunto2 = json_decode($adjunto1, TRUE); //this is teh line with the error
$value['archivo'] comes from the database, and if I see inside I get:
string(155) "{"nombre":["ejemploxls"],"archivoContenido":["id.--ejemploxls--fecha-26-04-2020-10-08.xls"],"fecha":["26-04-2020-10-08"],"size":[5632],"extension":["xls"]}"
When I converted the array to a json string using json_encode(), the array looked like this:
array(5) {
["name"]=>
string(11) "ejemplo.xls"
["type"]=>
string(24) "application/vnd.ms-excel"
["tmp_name"]=>
string(14) "/tmp/php7M0gVS"
["error"]=>
int(0)
["size"]=>
int(5632)
}
What is this error? What is GuzzleHttp?
$adjunto2 = \json_decode($adjunto1, TRUE);. If you want to obtain much more detailed answer, add a list of you php-imports (use), please.