I have an application which, from time to time, saves object arrays into text files. All the elements of the object array display identical structure.
As an example, consider the following object array:
[{"A":1,"B":2},{"A":11,"B":22},{"A":111,"B":222}]
The need is to save this into a file such that it would look like this:
[{"A":1,"B":2} ,
{"A":11,"B":22} ,
{"A":111,"B":222}]
meaning, one record within the text file for each object in the array.
The reason for that is that those arrays may include hundreds and up to several thousands of elements and I wish to keep these files READABLE for humans.
Is there any trick that can be invoked when using the standard JSON.stringify method? If not, any other suggestion will be appreciated.
Just stringify individual items.
You could use
map().join()but it's a bit slower.