J'ai un ensemble de résultats que j'ai converti en Json en utilisant la fonction php json_encode. Maintenant, je veux que ce résultat soit un tableau en js mais je n'ai pas d'idée pour le faire.
Mon tableau PHP est le suivant :
Array
(
[latestRating] => Array
(
[456] => Anonymous has rated xxx9
[457] => Anonymous has rated xxxx8
[458] => Anonymous has rated xxxx3.5
)
[latestUser] => Array
(
[242] => xxxxhas just signed up
[243] => xxxxxhas just signed up
[244] => xxxxxxhas just signed up
)
)
Lorsque j'utilise la fonction php json_encode, j'obtiens la chaîne suivante
{"latestRating":{"456":"Anonymous has rated mermaidbl00d 9","457":"Anonymous has rated GeorgiaHallx 8","458":"Anonymous has rated smithjhon 3.5","459":"Anonymous has rated Emilyxo 8.5","460":"Anonymous has rated leona 10","461":"Anonymous has rated leona 10","462":"Anonymous has rated W0rthlessliar 8","463":"Anonymous has rated Yousamsuck 9","464":"Anonymous has rated Aimeeerobbb 9","465":"Anonymous has rated lauramillerx 10","466":"Anonymous has rated tomwaz 1","467":"Anonymous has rated W0rthlessliar 1","468":"Anonymous has rated W0rthlessliar 1","469":"Anonymous has rated W0rthlessliar 1","470":"Anonymous has rated W0rthlessliar 1"},"latestUser":{"242":"rhiwilliamsx has just signed up","243":"W0rthlessliar has just signed up","244":"rebeccaronan has just signed up"}}
J'ai essayé d'utiliser JSON.stringify, puis jQuery.makeArray pour créer un tableau à partir de la chaîne. J'ai ensuite essayé eval('['+string+']') mais rien n'a fonctionné.
Je suis un débutant en Json et je n'ai pas pu trouver de soutien approprié.
Salutations Himanshu Sharma.