web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Splitting a JSON object
Power Automate
Unanswered

Splitting a JSON object

(0) ShareShare
ReportReport
Posted on by 54

Hello all,

 

I am trying to extract the exchange rate from CurrencyConverterAPI.com.

 

Is there a way I can split this from a JSON object into a key/value pair and store it in an excel table?

My desired output would be an excel table created and stored in onedrive/sharepoint.

 

Regards

Hidayat

 

 

Here is my flow:

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Below is the sample output of the parse JSON.

I need the content of the rates.

 

 

 

{
 "success": true,
 "timestamp": 1636638677,
 "base": "EUR",
 "date": "2021-11-11",
 "rates": {
 "AED": 4.21072,
 "AFN": 105.088368,
 "ALL": 122.482133,
 "AMD": 545.149901,
 "ANG": 2.065012,
 "AOA": 684.248748,
 "ARS": 114.831972

 }
}

 

 

 

Below is the compose output after executing parse JSON..

 

 

 

{
 "AED": 4.21072,
 "AFN": 105.088368,
 "ALL": 122.482133,
 "AMD": 545.149901
}

 

 

 

 

Capture.PNG

 

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    What we can try and do is to transform the JSON data through a number of steps to a Key/Value pair that we can use to populate an Excel file:

    2021-11-15_23-25-45.png

    (1) Stating with the output from the HTTP action:

    2021-11-15_23-07-40.png

     

    (2) Extract the rates property:

    2021-11-15_23-08-33.png

     

    (3) Transform each entry into an item, bounded by '{' and '}' . To use the replace function we need to work with string data type:

    2021-11-15_23-12-46.png

     

    replace(replace(replace(string(outputs('ComposeRates')),'{"', '[{"'),'}','}]'),',"','},{"')

     

    (4) Transform each item into a Key and Value pair:

    2021-11-15_23-10-26.png

     

    replace(replace(outputs('ComposeItems'),':',',"Value":') ,'{','{"Key":')

     

    (5) The data is still a string. Transform it to a JSON object:

     2021-11-15_23-14-32.png

     

    json(outputs('ComposeKeyValues'))

     

    (7) Finally output the JSON data to an Excel file:

    2021-11-15_23-38-20.png

     

    2021-11-15_23-43-58.png

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • Hidayat_Md Profile Picture
    54 on at

    Hi @ekarim2020 ,

     

    Super, the solution works perfectly!!!

    Truly a resident rock star. 😀

    Just an additional side question, is it possible to do filtering in the compose?

    Would need to filter on 3 rates instead of getting 6 rates from the http.

     

     

     

    {
     "success": true,
     "timestamp": 1636638677,
     "base": "EUR",
     "date": "2021-11-11",
     "rates": {
     "AED": 4.21072,
     "AFN": 105.088368,
     "ALL": 122.482133
    
    
     }
    }

     

     

     

    Hidayat

  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    To filter based on the currency code we can add two new actions and modify the Apply to each loop:

    2021-11-16_08-57-34.png

     

    (1) We can use an array to list the currency codes we require to be filtered. The currency codes must match exactly the codes returned by the API. You can add or remove currencies without affect the logic of the flow:

    2021-11-16_09-00-33.png

     

    (2) We use the Filter array action to filter the currency codes. The Filter Array action will loop through all the items in the ComposeJSON action, checking to see if the currency code is contained in our varCurrencyRatesRequired array:

    2021-11-16_09-02-50.png

     

     

    (3) Finally we update the Apply to each loop to use the results returned by the Filter array action and write these to Excel:

    2021-11-16_09-09-04.png

     

    Here is some sample output:

    2021-11-16_09-23-24.png

    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • Hidayat_Md Profile Picture
    54 on at

    Thank you so much @ekarim2020 !! 👍👍👍👍

     

    The solution works as expected. I have much to learn on PA. 🕺

     

    Regards

    Hidayat

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard