Hello, @SURULIRAJAN V - Thanks for reaching out. IMO, it's a lot easier to do this kind of task (checking duplicates in JSON data) in Azure Functions and then incorporate it into your Logic Apps workflow. Alternative to the Azure Functions can be the use of Inline Code action but note that it'll require that you have an Integration Account linked to your Logic Apps.
With your request for a working chart, I think that you meant a screenshot of the workflow in Designer mode so please see below for the approach that uses the Azure Functions running Nodejs in Consumption SKU:
- For the code that checks the duplicates and removes them, I've taken a snippet from a post on StackOverflow which checks the duplicates based on the value of the
name
property in the JSON. - With small edits for checking on the value of the
id
property, the code for the HTTP-triggered functions looks like this:
- A quick test of the function above with the exact JSON in your example results in the following output:
[
{
"title": "The Great Gatsby",
"author": "F. Scott Fitzgerald",
"editor": "Maxwell Perkins",
"id": "ISBN-123456789",
"language": "English"
},
{
"title": "To Kill a Mockingbird",
"author": "Harper Lee",
"editor": "Tay Hohoff",
"id": "ISBN-987654321",
"language": "English"
},
{
"title": "1984",
"author": "George Orwell",
"editor": "T.S. Eliot",
"id": "ISBN-567890123",
"language": "English"
},
{
"title": "One Hundred Years of Solitude",
"author": "Gabriel García Márquez",
"editor": "Salvador García",
"id": "ISBN-234567890",
"language": "Spanish"
}
]
- With the Function App created and tested successfully, it's now just a matter of incorporating it into the Logic Apps workflow. Here, I created a workflow that (a) triggers an HTTP request with a payload of the same JSON data, (b) removes duplicates by running our Azure Functions, (c) saves the filtered JSON into
files
container of the Blob Storage asoutput.json
file: - The workflow above results in the following:
I hope this answer helps you get up and running. Please let me know if you have any questions.