Adf schema mapping without an key

Palios, Jason 81 Reputation points
2021-06-03T15:29:12.92+00:00

In an copy data activity I have a hierarchical source to tabular sink mapping.

We extract data from an api.

within the data we have the following node
*,
"businessCommunication": {
"emails": [
"some-email@Company portal .com"
],
"landlines": [
""
],
"mobiles": [
""
]
},

I want to extract the email value.
In the advanced editor I tried to map this as : $['businessCommunication']['emails'][0]

But this does not work. I know I could get this to work with a DataFlow, but I'd prefer if this can stay in a CopyData activity.

Thanks

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

Accepted answer
  1. MartinJaffer-MSFT 26,091 Reputation points
    2021-06-15T01:32:21.667+00:00

    (EDITED, FOUND A SOLUTION)

    @Palios, Jason

    Given the sample data file (JSON):

    {"foo":[1,2,3,4,5]}  
    

    we can use alternative syntax to turn it into

    1  
    2  
    3  
    4  
    5  
    

    105608-image.png
    In the above picture, in the mapping I specify the collectionReference as $['foo'] and the source as foo not $['foo']. Also the type is specified in the destination.

    I found the subtle difference of $[...] to be very important. When $[...] is used, this is specifying the entire path. When leaving out the $[...] it can search for anywhere in the document, including the results of cross-apply that collectionReference does.


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.