Hello
I’try to pass a php array to c# Unity with JsonUtility.
But there’s something wrong.
Why this work :
{"users": [ {"users_id":"1","users_username":"Kabendji","users_password":"password","users_email":"email@gmail.com","users_name":"Kabendji","users_surname":"Kyan","users_adress":"adress","users_zipCode":"zipCode","users_phone":"000000","users_picture":"Image_null","users_date_login":"2016-06-05 18:56:58","users_date_registration":"2016-06-01 18:29:29","customers_group_customers_group_name":"Admin Group Test","country_country_name":"Belgium","users_type_users_type_name":"Administrator"}]}
And this one not :
{"users":{"users_id":"1","users_username":"Kabendji","users_password":"password","users_email":"email@gmail.com","users_name":"Kabendji","users_surname":"Kyan","users_adress":"adress","users_zipCode":"zipCode","users_phone":"000000","users_picture":"Image_null","users_date_login":"2016-06-05 19:04:11","users_date_registration":"2016-06-01 18:29:29","customers_group_customers_group_name":"Admin Group Test","country_country_name":"Belgium","users_type_users_type_name":"Administrator"}}
With the first one, I can’t use PHP array to parse Json from PHP to C# Unity
So I have to do something like this to make it work :
echo '{"users": [ '.json_encode($_row).']}';
instead of using a simple way like :
$_array = array();
$_array['users'] = $_row;
echo json_encode($_array);
In case of multi query it’s way harder without using array.
So can someone explain me, what I did wrong ?
Thanks you