Parse JSON String to JSON Object in C#.NET

前端 未结 4 1383
逝去的感伤
逝去的感伤 2020-12-06 04:31

I have a JSON String returned by my SOAP web service in .NET. It is as follows:

{
 \"checkrecord\":
   [
     {
      \"rollno\":\"abc2\",
      \"percentage         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 04:58

    Since you mentioned that you are using Newtonsoft.dll you can convert a JSON string to an object by using its facilities:

    MyClass myClass = JsonConvert.DeserializeObject(your_json_string);
    
    [Serializable]
    public class MyClass
    {
        public string myVar {get; set;}
        etc.
    }
    

提交回复
热议问题