I am developing an app that has java files and php files. The java files call to the php files, these execute queries in the ddbb and return the result as an array php, but printing it in the screen. I take this in java like an string, and I have to convert it to and array or collection, but I have no idea how to do it.
An example of the result that php prints is:
Array
(
[0] => Array
(
[id] => 1
[0] => 1
[name] => pepe
[1] => pepe
)
[1] => Array
(
[id] => 2
[0] => 2
[name] => antoñito
[1] => antoñito
)
[2] => Array
(
[id] => 3
[0] => 3
[name] => loló
[1] => loló
)
[3] => Array
(
[id] => 4
[0] => 4
[name] => ñoño
[1] => ñoño
)
[4] => Array
(
[id] => 5
[0] => 5
[name] => Antoñito
[1] => Antoñito
)
[5] => Array
(
[id] => 7
[0] => 7
[name] => José
[1] => José
)
)
If I use json_encode($the_array) this is the result:
[{"id":"1","0":"1","name":"pepe","1":"pepe"}, {"id":"2","0":"2","name":"anto\u00f1ito","1":"anto\u00f1ito"},{"id":"3","0":"3","name":"lol\u00f3","1":"lol\u00f3"},{"id":"4","0":"4","name":"\u00f1o\u00f1o","1":"\u00f1o\u00f1o"},{"id":"5","0":"5","name":"Anto\u00f1ito","1":"Anto\u00f1ito"},{"id":"7","0":"7","name":"Jos\u00e9","1":"Jos\u00e9"}]
Thanks everyone