MyObject obj = JsonConvert.DeserializeObject<MyObject>(json);
private StoreAndLoadMe DeserializeMe()
{
using (StreamReader file = File.OpenText(fileName))
using (JsonTextReader reader = new JsonTextReader(file))
{
JObject obj = (JObject)JToken.ReadFrom(reader);
return JsonConvert.DeserializeObject<StoreAndLoadMe>(obj.ToString());
}
}
private void SerializeMe(StoreAndLoadMe slm)
{
var json = JsonConvert.SerializeObject(slm, Formatting.Indented);
using (StreamWriter writer = File.CreateText(fileName))
writer.Write(json);
}
// Add Attribute to StoreAndLoadMe class:
[JsonObject]
internal class StoreAndLoadMe