Home > database >  how to compare 2 JSON files in Azure data factory
how to compare 2 JSON files in Azure data factory

Time:11-12

I'm new to Azure data factory. I want to compare 2 json files through azure data factory. We need to get new list of id's in current JSON file which are not in previous JSON file. Below are the 2 sample JSON files.

Previous JSON file :

{
  "count": 2,
  "values": [
    {
      "id": "4e10aa02d0b945ae9dcf5cb9ded9a083"
    },
    {
      "id": "cbc414db-4d08-48f2-8fb7-748c5da45ca9"
    }
  ]
}

Current JSON file:

{
  "count": 3,
  "values": [
    {
      "id": "4e10aa02d0b945ae9dcf5cb9ded9a083"
    },
    {
      "id": "cbc414db-4d08-48f2-8fb7-748c5da45ca9"
    },
    {
      "id": "5ea951e3-88d7-40b4-9e3f-d787b94a43c8"
    }
  ]
}

New id's has to perform one activity and old id's has to perform another activity. WE are running out the time and please help me out.

Thanks in advance!

CodePudding user response:

You can simply use a IfCondition Activity

enter image description here

If expression:

@equals(activity('Lookup1').output.value,activity('Lookup2').output.value)

enter image description here

Further I have used Fail Activity for False condition for better visibility.

enter image description here

--

Lookup1 Activity --> Json1.json

enter image description here

Lookup2 Activity --> Json2.json

enter image description here

  • Related