I am trying to echo the following JSON response to html using php.
This is the JSON response :
{
"data": {
"onward": [
{
"origin": "LHR",
"id": "SB15",
"rating": 0,
"destination": "FKK",
"PricingSolution": {
"TotalPrice": "USD445"
},
"Class": "Eco"
},
{
"origin": "LHR",
"id": "EH10",
"rating": 0,
"destination": "FKK",
"PricingSolution": {
"TotalPrice": "USD223"
},
"Class": "Eco"
}
]
}
}
This is how it should appear in html :
<body>
<ul class="myclass">
<li>ID: EH10, Price: 223, Class: Eco</li>
<li>ID: SB15, Price: 445, Class: Eco</li>
</ul>
</body>
I want it somehow to be sorted by Total price in Ascending order.
Tried
foreach($json['data'] as $data).
Doesn't seem to be working! Please help.