JSon.Net JObject.Parse

时间:2012-02-22 20:44:43

标签: c#-4.0 json.net

在下面的代码中我使用的是Json.net。出于某种原因,这个代码在我身上出错了 JObject o = JObject.Parse(picture);
但适用于 JObject googleSearch = JObject.Parse(googleSearchText);

有人可以告诉我为什么会这样吗?

string googleSearchText = @"{
  ""results"": [
  {
    ""GsearchResultClass"": ""GwebSearch"",
    ""unescapedUrl"": ""http://en.wikipedia.org/wiki/Paris_Hilton"",
    ""url"": ""http://en.wikipedia.org/wiki/Paris_Hilton"",
    ""visibleUrl"": ""en.wikipedia.org"",
    ""cacheUrl"": ""http://www.google.com/search?q=cache:TwrPfhd22hYJ:en.wikipedia.org"",
    ""title"": ""<b>Paris Hilton</b> - Wikipedia, the free encyclopedia"",
    ""titleNoFormatting"": ""Paris Hilton - Wikipedia, the free encyclopedia"",
    ""content"": ""[1] In 2006, she released her debut album...""
  },
  {
    ""GsearchResultClass"": ""GwebSearch"",
    ""unescapedUrl"": ""http://www.imdb.com/name/nm0385296/"",
    ""url"": ""http://www.imdb.com/name/nm0385296/"",
    ""visibleUrl"": ""www.imdb.com"",
    ""cacheUrl"": ""http://www.google.com/search?q=cache:1i34KkqnsooJ:www.imdb.com"",
    ""title"": ""<b>Paris Hilton</b>"",
    ""titleNoFormatting"": ""Paris Hilton"",
    ""content"": ""Self: Zoolander. Socialite <b>Paris Hilton</b>...""
  }
  ]
}";

picture = @"{
  ""root"": [
  {
    ""status"": ""success"",
    ""filename"": ""b79d597b-bac5-4448-9443-9d0d388c97d7.jpg"",
    ""mainpic"": ""true"",
    ""fullurl"": ""../userimages/b79d597b-bac5-4448-9443-9d0d388c97d7.jpg""
  },
  {
    ""status"": ""success"", ""filename"": ""f232b9fb-edf0-41b2-802f-f98ecf502b1c.jpg"",
    ""mainpic"": ""true"",
    ""fullurl"": ""../userimages/f232b9fb-edf0-41b2-802f-f98ecf502b1c.jpg""
  }
  ]
}";

JObject googleSearch = JObject.Parse(googleSearchText).Dump();
JObject o = JObject.Parse(picture).Dump();

0 个答案:

没有答案