0

EDIT !

I've found my answer on here so go there if you think you have the same problem !

My original question :

So recently I've been using the fs module to try creating my new json database and it succesfully worked ! This is the json file I had at first.

{
  "name":"Jake",
  "gender":"Male"
}

The problem is that when using fs.writeFile on my file for adding a new property. The file looks like this :

{"name":"Jake","gender":"Male","hobby":"art"}

This is really annoying as I have to use a website to edit my json data to automatically add the spaces and new lines. My question is that is it possible (and how) to automatically edit my file to become readable again after editing it ?

Malik Lahlou
  • 989
  • 1
  • 3
  • 19

0 Answers0