using ServiceStack.Text; namespace FieldOfSheep { public static void Main(String[] args) { object myClass; var str = myClass.Dump(); //Str now contains the JSON Values inside 'Object' } }
Saturday, 16 August 2014
ServiceStack Object Dump
There are times when you may need to dump an entire object to JSON for storing or for viewing, One example is to run an Object Dump on an Object or class at each step of a registraion page to see what the user is entering rather than getting final data at the end.
This would help some people to see why users are dropping off the site for example.
This is where 'ServiceStack.NET' comes into play - It has methods that support this functionality and one method is the 'Dump' method.
Its rather simple and easy to use here is a working example.
Subscribe to:
Posts (Atom)