title: How to append newlines to json?
body: <p>I am working on a Discord bot and want to save currency values in a json file. It's working just fine so far, but it's appending them to the json file in one single line and although it is entirely functional, I would like to be able to read it.</p>
  <p>This is the code</p>
  <pre><code>                let json = jsonfile.readFileSync(balance, { throws: false })
  
              let newBalance = {}
  
              for (let i = 0; i &lt; 3; i++) {
                  let val = embedJSON.fields[i].value
                  val = val.replace(&quot;,&quot;, &quot;&quot;)
                  let valSplit = val.split(&quot; &quot;)[1]
  
                  newBalance[`${embedJSON.fields[i].name}`] = valSplit
  
              }
              json[`${user}`] = newBalance
              jsonfile.writeFileSync(balance, json)
  </code></pre>
  <p>And this is what the json looks like</p>
  <pre><code>{&quot;Anth'auwe#0169&quot;:{&quot;Cash:&quot;:&quot;200&quot;,&quot;Bank:&quot;:&quot;399800&quot;,&quot;Net Worth:&quot;:&quot;400000&quot;},&quot;Layers#0169&quot;:{&quot;Cash:&quot;:&quot;0&quot;,&quot;Bank:&quot;:&quot;199838&quot;,&quot;Net Worth:&quot;:&quot;199838&quot;}}
  </code></pre>
  <p>If possible, I would like for it to look like this</p>
  <pre><code>    {
      &quot;Layers#0169&quot;: {
          &quot;Cash&quot;: 0,
          &quot;Bank&quot;: 0,
          &quot;Net Worth&quot;: 0
      },
      &quot;Anth'auwe#0169&quot;: {
          &quot;cash&quot;: 0,
          &quot;bank&quot;: 0,
          &quot;Net Worth&quot;: 0
      }
      }
  </code></pre>