问题
I have an object that is created by Newtonsoft's JSON serializer. I need to get the JSON string that was used to create the object. How do I serialize the object into a simple JSON string?
回答1:
Try this:
public string jsonOut()
{
// Returns JSON string.
return JsonConvert.SerializeObject(this);
}
来源:https://stackoverflow.com/questions/6690395/newtonsoft-object-%e2%86%92-get-json-string