jsonazure-data-factorysendgrid-api-v3

Azure Data Factory - WEB activity output won't return JSON


I am consuming a SENGRID API SENDERS trying to do a GET request (https://api.sendgrid.com/v3/marketing/senders) and the output is not returning in JSON format.

This is an example of how the data is returning on ADF:

"[{\"id\":1111111,\"nickname\":\"Marketing\",\"from\":{\"email\":\"abc@m.abc.com\",\"name\":\"Marketing\"},\"reply_to\":{\"email\":\"abc@m.abc.com\",\"name\":\"\"},\"address\":\"sometext\",\"address_2\":\"\",\"city\":\"sometext\",\"state\":\"\",\"zip\":\"00000\",\"country\":\"ABC\",\"verified\":{\"status\":false,\"reason\":null},\"updated_at\":1111111,\"created_at\":111111,\"locked\":false}]\n"

I have tried other APIs and they return JSON, but in this case it's different. I have also tried the API that I am having problems with on Postman it returns a JSON, but I don't know why it'ss not working on ADF.


Solution

  • As per this Documentation, currently web activity in ADF does not support JSON arrays as response.

    enter image description here

    That is why it is returning the JSON array as a string. I have tried with a sample JSON array and you can see it returned it as JSON string.

    enter image description here

    As a workaround, to get the above string as a JSON array, use @json() on the web activity output response string.

    @json(activity('Web1').output.Response)
    

    This will convert the JSON string as JSON. For sample I am storing this in an array variable.

    enter image description here

    Result:

    enter image description here