Inserting a JSON list in Cosmos DB

Devashish Parmar (BLR GSS) 86 Reputation points
2022-12-20T12:51:02.083+00:00

I am using ADF to load documents to Cosmos DB. The challenge is I want to have a sub JSON format inside a list i.e. [ ].

Below is a sample format.

{
"paymentFrequency": "SP",
"address": [
{
"street1": "GA04230-US",
"street2": 0,
"street3": "359668276007920",
}
],
"partitionKey": "partitionKey1",
}

Note the values inside 'address' is a list.

Can you help me achieve it using Azure Data FActory (ADF)?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

Answer accepted by question author
  1. ShaikMaheer-MSFT 38,556 Reputation points Microsoft Employee Moderator
    2022-12-21T06:44:17.803+00:00

    Hi @Devashish Parmar (BLR GSS) ,

    Thank you for posting query in Microsoft Q&A Platform.

    You can consider using flatten transformation to flatten the array(list). Click here to know more about flatten transformation.

    You can consider checking below video as well about flatten transformation.
    Flatten Transformation in Mapping Data Flow in Azure Data Factory

    Kindly check below where I tried same
    Source File and Source Transformation in dataflow.
    272853-image.png

    Flatten Transformation:
    272871-image.png

    After loading data to sink storage using Sink transformation
    272783-image.png

    Hope this helps. Please let me know if any further queries.

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

    Please consider hitting Accept Answer button. Accepted answers help community as well.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.