Search HoldMyTwist

Remove duplicate tags from an array in Make

Use deduplicate in Make Free to remove repeated tags. Check case differences and empty values, and understand why this does not prevent repeat runs.

Repeated ceramic tags passing through a brass gate into a row of distinct shapes

Repeated tags can clutter a list before you pass it to another step. Make's deduplicate function removes repeated values within one array. This exercise also shows which values it leaves alone.

Before you start

You can create a Make Free account (opens in a new tab) or sign in. No other app connection is needed. Keep the practice scenario Inactive and use Run once.

1. Create a list with deliberate repeats

  1. In Scenarios, click Create scenario. Name it Unique tags practice at the top left.
  2. Add JSON > Parse JSON. Leave Data structure empty and paste the example below into JSON string.
  3. Save the module and scenario. Choose Save anyway only for an unused-output warning.
  4. Click Run once, then Run anyway for that warning. Inspect the source's tags array.
Text to copy

{"tags":["sale","new","sale","Sale",""]}

Full Make editor with a tags array containing a repeat, a case difference and an empty value

Full Make editor with a tags array containing a repeat, a case difference and an empty value
Open full-size image

2. Apply deduplicate to the whole array

  1. Close the result panel. Click the plus to the right of JSON and choose Tools > Set variable.
  2. Set Variable name to unique_tags.
  3. Paste the expression below into Variable value. Check that tags is a coloured token from JSON module 1. If your source has another number, replace the token from the mapping panel.
  4. Save the module and scenario.
Text to copy

{{deduplicate(1.tags)}}

Full Make editor applying deduplicate to the full tags array

Full Make editor applying deduplicate to the full tags array
Open full-size image

Watch out

This removes repeats inside the current array. It does not remember tags from an earlier run or prevent a later action from creating the same record twice. In this example, sale and Sale remain different, and the empty value remains too.

3. Check what remains

  1. Click Run once.
  2. Open the Tools result bubble. Under Output, expand unique_tags.
  3. Check the four items: sale, new, Sale and one blank value.

Full Make editor showing sale, new, Sale and an empty value after deduplication

Full Make editor showing sale, new, Sale and an empty value after deduplication
Open full-size image

The second sale is removed. Capitalisation and blank-value cleanup are separate decisions. If your workflow should treat sale and Sale as the same tag, convert every tag to the same letter case before removing duplicates.

If the result is unexpected

Check that you passed the full tags array, not its first item or a comma-separated string. This example uses simple text values. For an array of objects, Make documents distinct with a key for comparing a specific property. Choose that key deliberately and inspect which record survives before using customer data.

For a one-off cleanup, a spreadsheet may be simpler. Check the Free-plan limits before scheduling this in Make.

Source: Make array functions (opens in a new tab). Screenshots show fictional practice data.

Share this guide