views:

567

answers:

2

This is basically my problem: I have a JObject (I'm using Json.Net) that I constructed with LINQ to JSON (also provided by the same library) and, when I use the "ToString()' method with object, it throws the results in formated JSON.

How do I set the formatting to "none" for this?

Thanks in adavance =)

+1  A: 

If you pass the object to the SerializeObject method on JavaScriptConvert/JsonConvert (depending upon your version) it will return the JSON without formatting.

James Newton-King
A: 

You can also do the following;

string json = myJObject.ToString(Newtonsoft.Json.Formatting.None);
Simpu