Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

servicestack.text formatted indented json

Tags:

servicestack

Is it possible to get the servicestack.text to produce formatted/indented json?

I was wanting it to write the json to a text file. it would be nice if it was already formatted nicely.

like image 565
Damian S Avatar asked Nov 14 '12 03:11

Damian S


2 Answers

Checkout the .Dump() extension method. Should be what you're looking for.

like image 173
Jeff Mitchell Avatar answered Nov 19 '22 10:11

Jeff Mitchell


Update from 2017, from this answer:

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

like image 41
user2441511 Avatar answered Nov 19 '22 10:11

user2441511