Does ServiceStack.Text offer pretty-printing of JSON?

.net, c#, json, servicestack

Solution

The `T.Dump()` and `T.PrintDump()` extension methods in ServiceStack.Text are just a pretty formatted version of the JSV Format that's created with the TypeSerializer class or `T.ToJsv()` Extension method. It is only to provide a human friendly dump of data, it's not parseable.

The new `string.IndentJson()` extension method available from v4.5.5 will let you pretty-print JSON otherwise you can install a Pretty JSONView extension for Chrome or Firefox to see pretty JSON or you can paste the JSON in jsonprettyprint.com

Problem

TL;DR: Is there a built-in way in ServiceStack.Text to produce pretty-printed JSON? I am using ServiceStack.Text for doing JSON serialization. It works really good so far, but the created JSON (using `.ToJSON()`) is not formated with whitespaces or newlines (most likely to save space when sending over the network). However, in some circumstances it would be nice to have the JSON formatted for easier human-readability. The `.Dump ()` method does some sort of formatting, however does not produce valid JSON (i.e. the surrounding doublequotes are missing).

Original source