How can I access the elements of this json?
string(305) "{"puesto":"181","sexo":"Hombre","edad":"28","experienciaPuesto":"1","diasTrabajados":"Lunes,Martes,Miercoles,Jueves,Viernes","id":"6","idPromocion":"61,64,69,4","habilidades":"1,3,2","paquetesLenguajes":"Excel,Power point,Word","conocimientosEspecificos":"1,2","sueldo":"600.00","ultimoGradoEstudios":"6"}"
I tried to do it this way but it doesn't work
echo $solicitudEmpleo['puesto'];
What you have is a text string, not an object.
First you have to convert that JSON text to a JSON object.
The
true
is to be able to handle it as "arrangement".You have to decode the json with
json_decode()
, being like this:The first one prints it in a
object
and the second in anarray
indexed one.