Read Json Data.But 能够访问第二个Object
Read Json Data.But able to access the second Object
如何读取此数据
"Data": [
{
"Candidate Details": {
"Salutation": "au.linkedin.com/in/324234",
"First Name": "test (Demo)",
"Last Name": "1MORN,2AFTE",
"Nationality": "",
"Australian Residency / Visa Status": "1PR",
"Email": "testn@324234.com",
"Mobile No.": "2345234",
"Home Telephone": "234234",
"Work Telephone": "234234"
},
"[Current Residential Address]": {
"City / Town": "234243",
"Province / State": "23423",
"ZIP / Post Code": "234234",
"Country": "0_AU"
},
"[Education & Experience]": {
"Seniority": "0000-00-00 00:00:00",
"Speciality": "",
"Highest Education": "This is a test resume submitted with the following account details:\r\nnotes",
"Professional Qualification": "great exp",
"Educational Summary": "234234 in 234 First Aid",
"Work Experience": "2006-07-23 06:59:59",
"Australian Work Experience": "EMP",
"Work Experience Years": "Z_11+",
"Medical Registration": "GENER"
},
"[Availability & Preferences]": {
"Current Employment Status": "none",
"Can Relocate?": "",
"Available to Start": "01-Jan-1970",
"Salary Range": "",
"Location Preference": "1_profile1376113217.jpg",
"Positions Interested In?": "234234.doc"
},
"Additional Notes": [
"324(Demo)"
]
}
我可以轻松阅读候选人详细信息,但无法访问 [当前居住地址]。
代码写在下面
var ss = o["Data"];
JArray s = ss as JArray;
var dt = s.ToArray();
foreach (var dss in dt)
{
var dtt = dss["Candidate Details"];
}
dtt 仅获取第一条记录,但不获取 Select 其余参数。
您的数组只有一个条目 - 依次具有 "Candidate Details"
、"[Current Residential Address]"
等属性(尚不清楚这是否真的需要是一个数组。)
如果要遍历所有属性,可以使用:
// Your array entry is an object
foreach (JObject candidate in s)
{
foreach (var pair in candidate)
{
Console.WriteLine("{0} = {1}", pair.Key, pair.Value);
}
}
或者,如果您知道所需的属性,则可以按名称获取每个属性,就像您已经在获取候选人详细信息时所做的那样。
如何读取此数据
"Data": [
{
"Candidate Details": {
"Salutation": "au.linkedin.com/in/324234",
"First Name": "test (Demo)",
"Last Name": "1MORN,2AFTE",
"Nationality": "",
"Australian Residency / Visa Status": "1PR",
"Email": "testn@324234.com",
"Mobile No.": "2345234",
"Home Telephone": "234234",
"Work Telephone": "234234"
},
"[Current Residential Address]": {
"City / Town": "234243",
"Province / State": "23423",
"ZIP / Post Code": "234234",
"Country": "0_AU"
},
"[Education & Experience]": {
"Seniority": "0000-00-00 00:00:00",
"Speciality": "",
"Highest Education": "This is a test resume submitted with the following account details:\r\nnotes",
"Professional Qualification": "great exp",
"Educational Summary": "234234 in 234 First Aid",
"Work Experience": "2006-07-23 06:59:59",
"Australian Work Experience": "EMP",
"Work Experience Years": "Z_11+",
"Medical Registration": "GENER"
},
"[Availability & Preferences]": {
"Current Employment Status": "none",
"Can Relocate?": "",
"Available to Start": "01-Jan-1970",
"Salary Range": "",
"Location Preference": "1_profile1376113217.jpg",
"Positions Interested In?": "234234.doc"
},
"Additional Notes": [
"324(Demo)"
]
}
我可以轻松阅读候选人详细信息,但无法访问 [当前居住地址]。 代码写在下面
var ss = o["Data"];
JArray s = ss as JArray;
var dt = s.ToArray();
foreach (var dss in dt)
{
var dtt = dss["Candidate Details"];
}
dtt 仅获取第一条记录,但不获取 Select 其余参数。
您的数组只有一个条目 - 依次具有 "Candidate Details"
、"[Current Residential Address]"
等属性(尚不清楚这是否真的需要是一个数组。)
如果要遍历所有属性,可以使用:
// Your array entry is an object
foreach (JObject candidate in s)
{
foreach (var pair in candidate)
{
Console.WriteLine("{0} = {1}", pair.Key, pair.Value);
}
}
或者,如果您知道所需的属性,则可以按名称获取每个属性,就像您已经在获取候选人详细信息时所做的那样。