Transform objects to a flat list, keep the unique values

How to transform objects to a flat list, and keep the unique values

This article explains how you change the following data structure:
"uniqueConfig": {
"color": {
"config": [
{
"color": "smokingblack matt"
},
{
"color": "smokingblack matt"
},
{
"color": "smokingblack matt"
},
{
"color": "blauw matt"
},
{
"color": "blauw matt"
},
{
"color": "blauw matt"
}
]
}
}
Into this structure:
"uniqueConfig": {
"color": {
"smokingblack matt": null,
"blue matt": null,
}
}
You'll need to select the setting "Chain multiple entity transformers".
In order to achieve the obtained result, you'll need the following Transformers being chained:
  1. Data, transform data using mappers and conditions
    1. Move using a pattern
      1. [Pattern] uniqueConfig.color.config
      2. [Replacement] uniqueConfig.color
  2. Node, transform nodes
    1. [Accessor] Pattern accessor
      1. [Pattern] uniqueConfig.color.*
    2. [NodeTransformers] List mapper
      1. [Key accessor]
      2. [Mappers] List: Flip keys and values
    3. [Value Mapper]
      1. [Key accessor]
      2. [Mappers] Standard
        1. [From] String color
        2. [To] null
  3. Data, transform data using mappers and conditions
    1. Move using a pattern
      1. [Pattern] uniqueConfig.color.*.*
      2. [Replacement] temp.color.$2
  4. Data, transform data using mappers and conditions
    1. [Transformers] Move using a pattern
      1. [Pattern] temp.color.*
      2. [Replacement] result.uniqueConfig.color.$1
 

The most important transformer in this example is the "List: Flip keys and values" transformer"

Screenshots

Transformer 1

Schermafbeelding 2021-01-14 om 16.17.47

Transformer 2

Schermafbeelding 2021-01-14 om 16.43.09

Schermafbeelding 2021-01-14 om 16.44.03

Schermafbeelding 2021-01-14 om 16.46.13

Transformer 3

Schermafbeelding 2021-01-14 om 16.47.00

Transformer 4

Schermafbeelding 2021-01-14 om 16.47.27