Hi everybody,
I want to get exchange rates from Sweden Central Bank with API and insert them about D365 entity.
I connect the API as below.
I got the connection results from API as xml.
Xml results are as follows:
Then, I tried to convert results to JSON from XML using Compose action within json() expression.
json(xml(body('HTTP')))
I tried to extract results with Parse JSON action as follow:
I try to get the result as below but because of @xmlns it gives "#text": "<data>" the data I need.
{
"?xml": {
"@version": "1.0",
"@encoding": "UTF-8"
},
"SOAP-ENV:Envelope": {
"@xmlns:SOAP-ENV": "http://www.w3.org/2003/05/soap-envelope",
"SOAP-ENV:Body": {
"ns0:getMonthlyAverageExchangeRatesResponse": {
"@xmlns:ns0": "http://swea.riksbank.se/xsd",
"return": {
"@xmlns": "",
"datefrom": {
"@xmlns": "",
"#text": "2020-11-02"
},
"dateto": {
"@xmlns": "",
"#text": "2020-11-30"
},
"informationtext": {
"@xmlns": "",
"#text": "Averages are calculated on published observations for the daily fixing rates. \r\n\r\nObservations are published daily at 12.15 p.m."
},
"groups": {
"@xmlns": "",
"groupid": {
"@xmlns": "",
"#text": "130"
},
"groupname": {
"@xmlns": "",
"#text": "Currencies against Swedish kronor"
},
"series": [
{
"@xmlns": "",
"seriesid": {
"@xmlns": "",
"#text": "SEKAUDPMI"
},
"seriesname": {
"@xmlns": "",
"#text": "AUD"
},
"unit": {
"@xmlns": "",
"#text": "1.0E0"
},
"resultrows": {
"@xmlns": "",
"period": {
"@xmlns": "",
"#text": "2020 November"
},
"min": {
"@xmlns": "",
"#text": "6.2465E0"
},
"average": {
"@xmlns": "",
"#text": "6.2861E0"
},
"max": {
"@xmlns": "",
"#text": "6.3272E0"
},
"ultimo": {
"@xmlns": "",
"#text": "6.2627E0"
}
}
},
What I want here is that there should not be @xmlns and "#text" objects in the result.
I want the results to be directly against the relevant objects:
"seriesid":"SEKAUDPMI",
"seriesname":"AUD",
"unit": "1.0E0",
What method can I use to get the format I need?