Like converting XML to Json or Json to XML, you can also use Newtonsoft to get formatted Json.
private static string FormatJson(string json) { dynamic parsedJson = JsonConvert.DeserializeObject(json); return JsonConvert.SerializeObject(parsedJson, Formatting.Indented); }
Note: You can use var instead of dynamic. Both will work.