Convert a JSON result to Array required for Create CSV action

Srinivas Mehenderker Nath 86 Reputation points
2023-02-20T13:15:42.0166667+00:00

Hi,

In my logic app, I have created steps as follows:

  • Oracle query step which fetches the result as JSON object
  • I have an array which I want to convert the JSON which is being returned as QueryResult and ResultSet.
  • When I try to set the variable value to either of above, it is giving the error as below: User's image The JSON looks like :
   {
     "OutputParameters": {},
     "ResultSets": {
       "Table1": [
         {
           "Field1": "value1",
           "Field2": "value2",
           "Field3": "value3"
        
         },
         {
           ......
   }
   ]
   }

Is there a way by which I can directly parse below JSON to array without the nested loop? The main objective is to pass the JSON to Create CSV.

Thanks,

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
{count} votes

1 answer

Sort by: Most helpful
  1. Bruno Lucas 4,436 Reputation points MVP
    2023-02-21T09:10:15.5733333+00:00

    Hi @Srinivas Mehenderker Nath

    If the main objective is to generate a CSV you can use the Json parser and it should expose the "Table1" as an array ready to be used

    First, prepare a valid version of the json. does not need an entire recordset. As long it represents the correct format. (couple records will do):

    User's image

    Second step: Add a "parse json" action and click on "use payload to generate schema". paste the json in the pop up . It will generate the schema for you

    User's image

    You don't need to pass to an array. I added below just to show how could be done if the goal is to pass to an array variable. you can go straight to "create csv table"

    User's image

    and that's it:

    User's image


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.