How to serialize data into indented json
<p>I am using this code to serialize the users into <code>json</code> text file.</p>

<pre><code>if (File.Exists(path))
{
    using (var file = File.CreateText(path))
    {
        var serializer = new JsonSerializer();
        serializer.Serialize(file, this.users);
    }
}
</code></pre>

<p>This is the result that I get : </p>

<p>[<img src="https://i.stack.imgur.com/625cR.png" alt="output]"></p>

<p>How can I get a result like this :</p>

<p>[<img src="https://i.stack.imgur.com/NPmtX.png" alt="pretty-print]"></p>