UPDATE
I found this answer from SOen , at the link suggested by @Pedrox, talks about reflection , would it apply to this case too?
As I've already been told here in the SOpt , I was trying to convert a list of objects to json. Well, now I need to retrieve this json list for an array of objects.
The problem is that json_decode
, as told to documentation , returns an array of a special object called stdObject
or an associative array, in my case this:
Array
(
[0] => Array
(
[Corrente] => Array
(
[tarifaManutencao] => 12.5
[numero] => 123
[proprietario] => teste
[saldo] => 3.1
[permissoesEspeciaisHabilitadas] =>
)
)
[1] => Array
(
[Poupanca] => Array
(
[quantidadeConsultas] => 0
[numero] => 456
[proprietario] => testeprop
[saldo] => 50
[permissoesEspeciaisHabilitadas] =>
)
)
[2] => Array
(
[Especial] => Array
(
[limite] => 500
[valorEmprestado] => 0
[jurosCobrados] => 0
[tarifaManutencao] => 20
[numero] => 789
[proprietario] => teste4
[saldo] => 100
[permissoesEspeciaisHabilitadas] =>
)
)
)
What I needed was to return the array as an object list, similar to what the serialize
and unserialize
functions do. In this topic that java has to do this by passing json
and POJO class I have a custom object for a method of lib Gson
, and it automatically converts, and also that I can do this using a foreach
or for
.
Is it possible for me to retrieve my Current, Saved, and Json Special objects similar to java?