Save first occurence from an array of elements

Certified Senior Developer

Hello, I need to create rule that takes an array of dictionaries in input and if multiple of these elements have the same "id" value, I want to take only the first one in a separate list:

ri!list:

{

{output: "OK, id: "abcd", description: "hello"},

{output: "OK", id: "abcd", description: "hi"},

{output: "OK", id: "yxz", description: "bye"},

{output: "OK", id: "yxz", description:"goodnight"},

{output: "OK", id: "opt", description: "ok"}

}

the output should be the following:

local!output: 

{
{output: "OK, id: "abcd", description: "hello"}, 
{output: "OK", id: "yxz", description: "bye"},
{output: "OK", id: "opt", description: "ok"}
}


  Discussion posts and replies are publicly visible