I happily use the Newtonsoft JSON library.
For example, I would create a JObject
from a .NET object, in this case an instance of Exception (might or might not be a subclass)
if (result is Exception)
var jobjectInstance = JObject.FromObject(result);
now I know the library can deserialize JSON text (i.e. a string) to an object
// only works for text (string)
Exception exception = JsonConvert.DeserializeObject<Exception>(jsontext);
but what I am looking for is:
// now i do already have an JObject instance
Exception exception = jobjectInstance.????
Well it is clear that I can go from on JObject
back to JSON text and then use the deserialize functionality, but that seems backwards to me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…