- Create your object with tags
[DataContract] public class Weather { [DataMember] public string Current; [DataMember] public string Forecast; }
- Instanciate your object
var weather = new Weather { Current = "30", Forecast = "cloudy" }; ```
- Call the method
string jsonStr = weather.ToJSON();
Console.WriteLine(jsonStr);
- Convert back to orginal class object
var obj = jsonStr.JsonToObj();
Console.WriteLine(jsonStr);
-A Wrapper class included to convert an object to json string -Quickson builds