How to pass source column name as parameter and then get its value?

I have defined a parameter col1 =$col_name. Now I want to use this in mapper expression.
Once it is replaced it should behave like a source input column and its value should source input value.

In the below screenshot, I have used same col_name coming from source and assigning to target column. in one senario it is direct and in other I am passing that column name as parameter. In 2nd scenarios it doesn;t work as expected. How do I achieve this?


The jsonPath() function can be used to read a value from an object at a given path ($col_name is your path here). So, you should be able to use the following expression to do what you want:

jsonPath($, _col1)

If you only have a property name and not a full path, you can use square-bracket notation to lookup the property. For example, if you set “col1” to “col_name” instead of “$col_name”, you can do:


The language only sees “_col1” as a variable containing a string, which is why the output is the string “$col_name”. You need to use the jsonPath() function to interpret the string as a path.

Thanks a lot. it is working as expected. I have one more question.

There is an option of LEAVE BLANK TO DELETE SOURCE PATH under target path. How can I put a parameter there and pass blank so that the corresponding source column is not mapped in output.
check the 2nd and 3rd target path. I am passing blank in col2 parameter. so it is showing null instead of not showing that column in output. But If i leave that column blank as in target 3, it doesn’t show it in output preview. How can I achieve this?


Thanks in advance.

If “_col2” contains the name of the property you want to delete, you can use the following in the Expression column:


When the “Target Path” column in the mapper is left blank, then the “Expression” column is treated as the JSON-Path to be deleted from the input document. So, if the property name to be deleted is not known ahead of time, you need to write the path to evaluate an expression to get the property name. That’s what this part of the path – [(...)] – is doing. The part between the parentheses is treated as an expression that should evaluate to the name of the property.

I understand that if target path is left blank it doesn’t show it in output.

Not sure, if you understood my question or I am not able to understand the answer. Restating the question.

Same thing I want to achieve with $[(_col2)]. where if col2 value is blank/null it should not show the output in preview. it should work exactly like row 3. instead it shows column name as null and value as City.

How can I make row 2 and row 3 work exactly same. What value should I pass in col2 parameter?
one example will be helpful.