Search code examples
jsonasp.net-mvcxamarin.formsjson.netjson-deserialization

How to deserialize multiple objects in Xamarin Forms?


I have two different class using that I am sending json response through API to another application, in short I am getting following json response :

{  
   "lmob_Forms":[  
      {  
         "Fields":"Certificate Name",
         "Validation":"R",
         "TabIndex":"1",
         "FieldType":"DropdownList",
         "DateFormate":"",
         "Details":null
      },
   ],
   "drop_Salutation":[  
      {  
         "id":1,
         "idvalue":"Kumari"
      },
      {  
         "id":2,
         "idvalue":"Mrs"
      },
      {  
         "id":3,
         "idvalue":"Ms"
      }
   ]
}

I have searched regarding the same but not able to solve this problem, Need help, Thanks In Advance :)


Solution

  • using json2csharp

    public class LmobForm
    {
        public string Fields { get; set; }
        public string Validation { get; set; }
        public string TabIndex { get; set; }
        public string FieldType { get; set; }
        public string DateFormate { get; set; }
        public object Details { get; set; }
    }
    
    public class DropSalutation
    {
        public int id { get; set; }
        public string idvalue { get; set; }
    }
    
    public class RootObject
    {
        public List<LmobForm> lmob_Forms { get; set; }
        public List<DropSalutation> drop_Salutation { get; set; }
    }