Azure Data Factory Rest APi Dynamic Maping not working

Praveen Nayakwadi 46 Reputation points
2021-08-06T10:51:50.293+00:00

Hello ,
I'm trying to dynamically map rest api to sql server using copy task with an example json output as below

      {  
         "country_code":"US",  
          
         "alerts":[  
            {  
               "regions":[  
                  "Madison",  
                  " Franklin"  
                  
               ],  
               "ends_utc":"2020-10-17T13:00:00",  
             
               "onset_local":"2020-10-17T02:00:00",  
 
               "description":"*  temperatures low and high winds ."  
            }  
         ],  
         "city_name":"Dayton",  
         "state_code":"OH"  
      }  

with

a map expression
as below
@json (' {
"type": "TabularTranslator",
"mappings": [
{
"source": {
"path": "$[''alerts''][0][''description'']"
},
"sink": {
"name": "description",
"type": "String"
}
},
{
"source": {
"path": "$[''city_name'']"
},
"sink": {
"name": "city_name",
"type": "String"
}
}
],
"collectionReference": "",
"mapComplexValuesToString": true
}')

The out put is only getting values for city but not for description.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
0 comments No comments
{count} votes

Accepted answer
  1. ShaikMaheer-MSFT 38,546 Reputation points Microsoft Employee Moderator
    2021-08-09T07:35:05.587+00:00

    Hi @Praveen Nayakwadi ,

    Welcome to Microsoft Q&A Platform. Thank you for posting your query here.

    It seems small syntax error in your json, Kindly use below syntax to access "description" property. I added . after [0] in json.

    "source":   
    	{   
    	   "path": "$[''alerts''][0].[''description'']"  
    	},  
    "sink":   
    	{  
    	    "name": "description",  
    	    "type": "String"  
            }  
    

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

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

    • Please accept an answer if correct. 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.

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.