im trying to replace every comma in my json file:
JavaScript
x
17
17
1
{
2
"friends": {
3
"count": "9",
4
"friends": [
5
"Xdevil_blueX",
6
"SpectakularBaby_YT",
7
"kingdondon96",
8
"Xxaland366xX",
9
"imbadinarsenal_99",
10
"EnderMox2",
11
"No0dles_s",
12
"cracon999",
13
"ionwarrior123"
14
]
15
}
16
}
17
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
1
10
10
1
Xdevil_blueX
2
SpectakularBaby_YT
3
kingdondon96
4
Xxaland366xX
5
imbadinarsenal_99
6
EnderMox2
7
No0dles_s
8
cracon999
9
ionwarrior123
10
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
1
2
1
friends.join('n')
2