Parsing Complex JSON in Azure Data Factory

Viewed 3038

Dears - I'm using ADF to parse output of a REST API that is coming in JSON structure. The problem is that JSON contains array of strings, each string value contains JSON object. I want to extract the values of the innermost JSON .. I've tried several attempts with no luck yet..

Sample JSON Structure

  {
    "tables": [
      {
        "name": "PrimaryResult",
        ,
        "rows": [
          ["{\"Subscription Name\":\"master\",\"Operation Name\":\"5f2a763e4f5cabb8d38dd66a\",... \"}","other nested JSON".....

I'm not able to parse those JSONs that are coming as strings surrounded by double quotes.

any ideas ??

1 Answers

You can use json function to change JSON string to JSON object.

My test:

Output of Web activity enter image description here

Use this expression to get value of Subscription Name:

@json(activity('Web1').output.tables[0].rows[0][0])['Subscription Name']

Output of Set variable activity:

enter image description here

Update

I'm not sure what you need. It seems you want to change all JSON string to JSON object.

If so, you can create an array variable, loop rows[0] by For Each activity and transform items to JSON object in a new array.

enter image description here

enter image description here

Related