Skip to main content
Swaps the keys and values of an array or object. Each value in the input becomes a key in the result, and the key it used to sit under becomes its new value. Use this when you have a plain list of values and want to turn it into a lookup you can check by name, or when you need to know the position each value held in the original list. Values have to become valid keys, so they must be plain text or whole numbers. If two items share the same value only the last one survives, because they would otherwise produce the same key.

Fields

This mapper has no settings. Point it at the list or object you want to flip and it transforms whatever value it receives.

Sample data

Input:
{ "tags": ["new", "sale", "featured"] }
Output:
{ "tags": { "new": 0, "sale": 1, "featured": 2 } }
Each tag has become a key, and its position in the original list (0, 1, 2) has become its value.