I have JSON returned from an API like below, where I want to fetch data of the latest date say 2022-01-13 in XML. Please can you guide me
daywisedata": {
"2022-01-11": {
"total_earning": 10,
"total_cost": 0
},
"2022-01-12": {
"total_earning": 5,
"total_cost": 10
},
"2022-01-13": {
"total_earning": 20,
"total_cost": 15
}
}
XML needs to be returned like
<daywisedata>
<total_earning> 20 </total_earning>
<total_cost> 15 </total_cost>
</daywisedata>