{
"3G/4G": [
{
"rs": "15",
"desc": "Pack validity Active Plan Total data 1 GB Data at high speed* 1 GB",
"validity": "N/A",
"last_update": "01-01-1970"
}
],
"2G": [
{
"rs": "26",
"desc": "JioPhone Pack validity 28 Days Total data 2 GB Data at high speed* 2 GB Voice NA SMS NA",
"validity": "28 days"
}
]
}
here im getting my response like this when i did deserialization im unable to map this list to respected entity class
public class Response
{
public int status { get; set; }
public Rdata rdata { get; set; }
}
public class Rdata
{
[JsonProperty(PropertyName="3G/4G")]
public List<_3G4G> _3G4G { get; set; }
[JsonProperty(PropertyName="2G")]
public List<_2G> _2G { get; set; }
public List Romaing { get; set; }
}
public class _3G4G
{
public decimal rs { get; set; }
public string desc { get; set; }
public string validity { get; set; }
public string last_update { get; set; }
}
public class _2G
{
public decimal rs { get; set; }
public string desc { get; set; }
public string validity { get; set; }
public string last_update { get; set; }
}
this is what i tried. I just want to map the response 3G/4G with my class i know we cant keep class name with numbers but im unable to map properties for 2g and 3g/4g Pls help me
Amit MohantyPosted Feb 19, 2024, 1:09 PM
Check this
Alpesh ManiyaPosted Feb 19, 2024, 2:11 PM
Jignesh KumarPosted Feb 19, 2024, 12:38 PM
Hello Jaya Prakas,
I have updated my previous answer, please do below change in your Rdata class and add [JsonProperty("3G/4G")] instead of [JsonProperty(PropertyName="3G/4G")]to your class.
Jaya PrakashPosted Feb 19, 2024, 11:42 AM
not working
Jignesh KumarPosted Feb 19, 2024, 11:26 AM
Hello Jaya Prakas,
You can use below class to convert your json response to object,
Note : add extra property as per your need in above class.
You need to convert your json object to class,