Import Data from REST API & Convert the JSON response to CSV output file

Vivek Komarla Bhaskar 956 Reputation points
2022-12-20T19:53:44.307+00:00

Attaching an example of how the JSON Response would be, I now want to use Logic Apps to convert this Json output to a CSV File.

273044-samplepayload.txt

  • I'm interested in only Data properties from the sample payload
  • Data property array elements is not always the same, in this example it is 1440 but actually it keeps changing and it can be anything

Expected output as below -

CSV output example, when the data: Array1 -
"Time","Total"
"1671321610000","490"

CSV output example, when the data: Array[5] -
"Time","Total"
"1671321610000","490"
"1671321670000","494"
"1671321730000","480"
"1671321790000","476"
"1671321850000","470"

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
0 comments No comments
{count} votes

Accepted answer
  1. Caroline ROY 81 Reputation points
    2022-12-22T16:12:34.307+00:00
    1. get the file content with the action OneDrive or OneDrive for Business, or get the data from a REST API with the action HTTP
    2. parse the JSON data with the action Data Operations
    3. create the CSV file, also with Data Operations. To specify the columns' name and the data, you need to choose the option "custom" in the field "columns" and enter the headers and values.
      See the screenshot:

    273434-2022-12-22-16h55-23.png

    result:
    273442-2022-12-22-17h11-13.png

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.