I have created a flow which takes input table values in JSON format and creates a csv table where I have used custom columns with values. I have defined the header and value for all my custom columns. For columns whose value is defined as single line of text I had no issues showing them in my csv table but when comes to choice columns (single select) the output in csv table shown is {value : "ABC"}, here I just need the value i.e. "ABC". So after going through several blogs I got an expression
join(xpath(xml(json(concat('{"body":{"value":', item()?['COLUMN NAME'] , '}}'))), '/body/value/Value/text()'), ', ')
this expression I have added in Value of my choice columns and it works fine I just get the value i.e. "ABC" in my csv table. My problem is that the flow fails to run and gives an error:
The execution of template action 'Create_CSV_table' failed. The column values could not be evaluated: 'The template language function 'json' parameter is not valid. The provided value '{"body":{"value":}}' cannot be parsed: 'Unexpected character encountered while parsing value: }. Path 'body.value', line 1, position 17.' and this happens when there are null or blank values in my custom columns.
How can I rectify the expression to make the flow run correctly?