flatten dataflow

arkiboys 9,696 Reputation points
2022-03-10T23:03:20.733+00:00

For the below json, I have a flatten activity
unroll by --> [] parcels
unroll root --> [] parcels

In preview I can see
1- parcel columns --> name and state populated.
2-
I added in Flatten settings, the column: parcels.locations but that only shows
location[1]
location[2]

Question, how do I see the values for the location in preview?

In

parcels {} complex
pfield1
pfield2
...
quantities [] complex
qfield1
qfield2
locations []
lfield1
lfield2
...

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,992 questions
{count} votes

Accepted answer
  1. AnnuKumari-MSFT 33,721 Reputation points Microsoft Employee
    2022-03-11T17:05:39.753+00:00

    @arkiboys ,

    We need to use another flatten transformation in order to flatten the nested array. However , in your case, all the nested array inside parcel[] are of same level , not hierarchical. You can split the first flatten activity using transformation called 'New branch' which will create a copy of first flatten transformation and then use subsequent flatten transformations for quantity[],location[] , etc. Post that, you can use join or union transformation for further requirement .

    182362-image.png

    182371-image.png

    If the above suggestion was helpful, kindly do click Accept Answer and Up-Vote for the same. In case you have any further query please do let us know.


1 additional answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 33,721 Reputation points Microsoft Employee
    2022-03-11T14:21:13.617+00:00

    Hi @arkiboys ,
    Thankyou for using Microsoft Q&A platform and posting your query.
    As per my understanding, you are trying to flatten the nested JSON data using dataflow and you want to preview the items of the array in data preview tab. Please let me know if my understanding is incorrect.

    I tried to repro your scenario with the shared json content with same settings:
    unroll by --> [] parcels
    unroll root --> [] parcels

    In order to view the items of the array you need to click on the dropdown button present at the left. Please see the below image for reference. Use another flatten activity to flatten the nested array . Eg. quantities[], locations[] , etc.

    182229-image.png

    182230-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

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.