Transformer unable to output list of keys in a map

I have a use-case where I want list of keys from a map to be presented in dropdown.

I have created a map using a transformer, and using it's value in another transformer.
I can see it is a map, but isn't giving out keys (or values) when trying to use Object.keys({{transformer1.value}}) (or Object.values).

Please let me know if I am doing something wrong.

This is the result I want

This is the empty result I am getting, despite having a map as output of previous transformer.


If you are trying to get the values of the keys (e.g. 9:00am to 4:00pm) in the drop down then you need to do a little more work:

Object.keys(pairs).map( key => pairs[key] )

Object.keys(object) will return the keys of the object as an array -- but you really want the value of those keys (not the key literal). By mapping (essentially looping over the array of keys) you can access the value from the original object.


Hi @Ron_West ,

I am planning to do this using labels and values of a dropdown, (will put '9:00am to 4:00pm' in label and '2' in value).
But the thing that I wanted to know is why is Object.keys not working if I am using value of another transformer, when it's working perfectly fine for a variable initialised here itself.

I am not 100% sure I understand how you are trying to use this data in the other location. However, in your example of trying to populate a drop down box with the values from the map if you use:


The return of that will be an array [] with the values in that array equal to the 'names' of the keys in the original object (e.g. in your case [1,2].

If you are interested in populating a selection list with the values of those keys (and the the names of the keys themselves) -- you would need to do something similar to what I was suggesting:

Object.keys(object).map( key => object[key])

Yes, exactly!
I expect it to return [1,2] only.

But as you can see in 2nd image, below Transformer ran successfully, the transformer is not returning anything.

Sorry, misunderstood what you were trying to do. Can you hover over 'militaryTimeTo12HrFormat' in your transformer? Are we sure that is an object?

Really sorry, I misunderstood the whole issue at my end.
Was trying to run this over a map, which doesn't work in JS.

Consider issue as resolved. :white_check_mark:
Thanks for the help @Ron_West