Converting JSON to JSONLines

Hi Retool Team,

i would like to request a new feature. I need to convert, loop created Data in the Java Script to a JSONLine for a payload in a API Post Request. I can only convert with JSON.stringify my array to a valid json form but i need them without the comma.

The expected output is like

{"identifier":"10","values":{"stock_qty":[{"scope":null,"locale":null,"data":5}]}}
{"identifier":"40","values":{"stock_qty":[{"scope":null,"locale":null,"data":5}]}}
{"identifier":"50","values":{"stock_qty":[{"scope":null,"locale":null,"data":5}]}}

without commas.

Is there any way that i didnt see?

with Json.stringify() i get only a JSON String formatted payload but i need it only as own line.

Is there a way to do it? If not i would like to request this function. Its very helpfull not only for me. I saw already someone requested it but there is not a solution yet.

Would be nice if you could implement this feature. So i dont need to use a converter for :confused:

Thanks

First time I have heard of JSON lines.

Turns out is is as simple as

data.map(x=>JSON.stringify(x)).join('\n')

stringify each object in the array individually and add a newline.