Skip to content
Advertisement

How do I replace a json comma with a new line

im trying to replace every comma in my json file:

JavaScript

so i need to replace every comma in the friends list with a new line

for example i want the output to be like this (just note im not using node.js)

JavaScript

Advertisement

Answer

You can easily do that taking the array ‘friends’ and turning it into a string while you break the line in each comma. follows like this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement