question

KothaiRamanathan-7384 avatar image
0 Votes"
KothaiRamanathan-7384 asked KothaiRamanathan-7384 commented

Adding element to a json object in ADF

I have a pipeline which has an object as a parameter. This object contains a json. Want to know if there are any ADF inbuilt function through which I can add another element to this json.

Initial json :
{
'fistname":"abc"
{
New json :
{
'fistname":"abc",
"lastname":"xyz"
}

Is there any add/addElement() function which can add another element to the existing json.


Thanks,
Kothai.

azure-data-factory
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @KothaiRamanathan-7384 ,

Thanks for the ask and using the forum .

While I explore more on this , can you please eloborate more on the use case here please ?

Thanks
Himanshu

0 Votes 0 ·

@HimanshuSinha-MSFT : We are creating generic patterned pipelines which are driven through configuration based out of json contexts. In some cases, it is needed that based on certain criteria, there is a need to modify the json context. Hence the ask, thanks

0 Votes 0 ·

1 Answer

HarithaMaddi-MSFT avatar image
0 Votes"
HarithaMaddi-MSFT answered KothaiRamanathan-7384 commented

Hi @KothaiRamanathan-7384,

Welcome to Microsoft Q&A Platform. Thanks for posting the query.

There is no function to add element to JSON string in ADF and this can be achieved by using Azure Functions or indirectly using ADF with array variables which supports append operation. JSON can be converted to Array and then element can be appended to it which later can be converted to string and JSON while loading. Below are snaps related to it.

47159-image.png

47327-image.png

47401-image.png


Please let us know for further queries and we will be glad to assist.



  • 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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @HarithaMaddi-MSFT for the details. I have gone the Azure Function route and that seemed simpler. It would be good if ADF supports some built-in JSON functions, thanks.

1 Vote 1 ·