1

I want to extract "email" from JSON using ADF/Synapse.

Below is the JSON that I want to flatten and extract all "email" which is in an object in a multidimensional array:

{
  "input": {
    "title": [
      "ALIAS_VALUES",
      "ALIAS_COUNT"
    ],
    "values": [
      [
        {
          "code": "aaaa",
          "email": "[email protected]"
        },
        55
      ],
      [
        {
          "code": "bbbb",
          "email": "[email protected]"
        },
        10
      ],
      [
        {
          "code": "cccc",
          "email": "[email protected]"
        },
        18
      ]
    ],
    "IsNew": false
  },
  "errors": []
}

I'm trying to return a .csv output that only includes "email". I've tried using consecutive copy activities as well as a data flow using the flatten activity. I'm now trying to parse the JSON using a lookup activity.

1 Answer 1

0

you basically have a nested array inside `input.values`, where each element is itself an array, and the first element of that sub-array is an object containing `"email"`.

In Azure Data Factory (ADF) or Synapse Data Flows, you can flatten this cleanly without multiple copy activities.

Here’s a step-by-step approach using a Mapping Data Flow:

---

Source

• Point your Source dataset to the JSON file (or API output).

• In Projection, make sure the schema is imported so you can see `input.values`.

---

First Flatten

• Add a Flatten transformation.

• Unroll by: `input.values`

This will give you each inner array as a row.

---

Second Flatten

• Add another Flatten transformation.

• Unroll by: `input_values[0]` (the first element of the inner array — the object with `email`).

• Now you can directly access `email` as a column:

`input_values[0].email`

---

Select Only Email

• Add a Select transformation.

• Keep only the `email` column.

Sink

• Set your Sink dataset to CSV.

• Map `email` → `email` in the output.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.