Newtonsoft Object → Get JSON string

放肆的年华 提交于 2019-12-20 16:19:25

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!