How to replace all linebreaks from an output of a csv data operation

Vivek Komarla Bhaskar 911 Reputation points
2024-08-15T09:15:03.2666667+00:00

With Azure logic apps, I am taking json as an input and generating a csv output from it. There is a requirement for me to remove all the line breaks from my csv output if it looks like this:

A

B

C

D

I expect the final response to be stored in a variable as A,B,C,D. Below are all possible options I've tried, but none of them work -

Screenshot 2024-08-15 at 10.01.27

Approach 1: Created a new singleReturn variable

replace(body('Create_CSV_table'),variables('var_newLine'),',')

Approach 2:

replace(body('Create_CSV_table'),decodeUriComponent('%0A'),',')

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,087 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sonny Gillissen 3,351 Reputation points
    2024-08-16T18:35:37.6333333+00:00

    Hi Vivek Komarla Bhaskar

    Thanks for reaching out on Microsoft Q&A!

    Your plan of attack seems correct, however I do believe that the place where you're replacing the text is where it is going wrong. I think you should already remove the new line feed in the JSON, and push that to the CSV as input, kinda like this:

    json(replace(string(body('YOUR_JSON_ACTION')),variables('``var_newLine``'),','))

    Please click ‘Accept answer’ if you think my answer is helpful. Feel free to drop additional queries in the comments below!

    Kind regards,

    Sonny

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.