Hi,
I have a class
public class Employee
{
public string EmpId { get; set; }
public string EmpName { get; set; }
public int Age { get; set; }
public string[] qualification { get; set; }
}
And Json File
===========
[{ "empid": 53931, "empname": "Sundar", "age": "42", "qualification": [],
"empid": 53932, "empname": "Ramu", "age": "44", "qualification": []}
my program to read json file
=======================
var jsonData = System.IO.File.ReadAllText(fullPath);
var readData = JsonConvert.DeserializeObject>(jsonData);
The readData doesn't bind values to the qualification
Employee.empid Employee.empname Employee.age
53951 Sundear 42
53952 Ramu 44

Sachin SinghRank #66 · 26.2K reputationPosted Nov 4, 2022, 6:21 AM EDT
As per your given Json your class structure is wrong it should be
// Root myDeserializedClass = JsonConvert.DeserializeObject>(myJsonResponse); public class Root { public int empid { get; set; } public string empname { get; set; } public string age { get; set; } public List qualification { get; set; } }credit :- https://json2csharp.com/
Janardhana Rao Kotagiri130 reputationPosted Nov 4, 2022, 7:48 AM EDT
Hi Sachin,
Thank you very much for your response. I'll check