I have this json response
{"success":true,"results":[{"response":["random1"],"id":"6566","Limit":1},{"response":["random2"],"id":"6563","Limit":1},{"response":["random3"],"id":"6568","Limit":1}]}
All I need is to extract the random1,random2,random,3 from response so the final results will be:
- random1
- random2
- random3
I have this script
$jsonData = file_get_contents("json");
$json = json_decode($jsonData,true);
foreach($json["results"][0]["response"] as $data) {
{
echo json_encode($data);
}
}
But this will extract only
- random1
If I change [0] in [1] will extract the random2 and [2] random3
How can I get random1,random2,random3, response at once? so the final echo will be:
- random1
- random2
- random3
Thank you in advance, any help would be appreciated!