In ADF flatten a JSON result from REST

Srinivas Mehenderker Nath 86 Reputation points
2023-08-21T07:10:29.84+00:00

Hi All,

I am trying to use fixer API for fxrate conversion using REST API feature required as an ETL step in ADF.

The below API call returns a JSON result:

https://data.fixer.io/api/latest?access_key=<myaccesskey>&base=GBP&symbols=USD

{"success":true,"timestamp":1692600783,"base":"GBP","date":"2023-08-21","rates":{"USD":1.272556}}

Next, I am applying the flatten step to get the above json in key value pair format. The unroll by dropdown does not have any selectable items. And when I preview the data:

Spark job failed: { "text/plain": "{"runId":"56e350cf-9928-4ac4-9963-115b0c58aa38","sessionId":"34d04d95-d0b7-43ad-b20a-a5f379b0032c","status":"Failed","payload":{"statusCode":400,"shortMessage":"DF-FOLDWN-001 at FoldDown 'flatten1'(Line 19/Col 8): Atleast one of unrollby or unrollMultiple expression expected","detailedMessage":"Failure 2023-08-21 06:08:55.013 failed DebugManager.processJob, run=56e350cf-9928-4ac4-9963-115b0c58aa38, errorMessage=DF-FOLDWN-001 at FoldDown 'flatten1'(Line 19/Col 8): Atleast one of unrollby or unrollMultiple expression expected"}}\n" } - RunId: 56e350cf-9928-4ac4-9963-115b0c58aa38

Please advise how to handle this scenario where I do not have any item to unroll.

Regards,

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

1 answer

Sort by: Most helpful
  1. QuantumCache 20,366 Reputation points Moderator
    2023-08-21T18:33:38.69+00:00

    Hello @Srinivas Mehenderker Nath

    I see that the Source JSON has no Array content!

    Array can only be flattened!

    I have added an Array to the payload, which can be Flatten !

    User's image

    User's image

    As you can see we can flatten only Array!

    User's image

    User's image

    User's image


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.