1. If seen was not given, then let seen be a new empty .

    2. If seen contains input, then return invalid.

    3. Jump to the appropriate step below:

      If (input) is Number

      1. If input is NaN then return invalid.

      2. Otherwise, return a new key with number and value input.

    For example, the value [10, 20, null, 30, 20] is converted to an with subkeys 10, 20, 30.