0
nyTimesからjson文字列 "jasonContent"を取得しています。私は以下のコードを書くとき、私は、合計の値を取得し、オフセットが、私は結果に興味がありますが、私は受け付けておりresults.The文字列のために何を取得していないのですができ、この文字列を解析するために、このC#でJson Stringを解析中に値を取得できません
{
"offset": "0",
"results": [
{
"body": " news goes here",
"byline": "By SANA SIWOLOP",
"date": "20110511",
"title": "SQUARE FEET; Chelsea Piers, a Manhattan Sports Center, Expands Close to Home",
"url": "http:\/\/www.nytimes.com\/2011\/05\/11\/realestate\/commercial\/chelsea-piers-a-manhattan-sports-center-expands-close-to-home.html"
},
{
"body": "news 2 goes here",
"byline": "By ROB HUGHES",
"date": "20110511",
"title": "ON SOCCER; Racial Politics Rear Their Head in French Soccer",
"url": "http:\/\/www.nytimes.com\/2011\/05\/11\/sports\/soccer\/11iht-SOCCER11.html"
},
{
"body": "news3 does here",
"byline": "By RICHARD SANDOMIR",
"date": "20110511",
"title": "Gus Johnson Joins Fox Sports",
"url": "http:\/\/www.nytimes.com\/2011\/05\/11\/sports\/gus-johnson-joins-fox-sports.html"
},],"tokens": [
"sports" ],
"total": 152539
}
のようなものです私は次のコードを書いています
public class nytimesnews
{
public string offset { get; set; }
public resultobject news2;
public string total { get; set; }
}
public class resultobject
{
public results[] news;
}
public class results
{
public string body { get; set; }
public string byline { get; set; }
public string date { get; set; }
public string title { get; set; }
public string url { get; set; }
}
nytimesnews parse = JsonConvert.DeserializeObject<nytimesnews>(jasonContent);