Read string json with Json.NET

Oct 13, 2008 at 4:36 PM
I want to implement a search in Google for my site using the data of codified return in the JSON strings.
  (http://code.google.com/apis/ajaxsearch/documentation/#fonje). 

In my code, I read the results within the following code (url is an example) : 

Dim client As WebClient = New WebClient
Dim urlFormat As String = ""
If String.IsNullOrEmpty(urlFormat) Then
urlFormat = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Paris%20Hilton"
End If
Dim url As Uri = New Uri(urlFormat)
Dim Search As String = client.DownloadString(url)



I want to decode it, but I obtained an error: 
Dim reader As JsonTextReader = New JsonTextReader(New StringReader(Search))
reader.Read()



I obtained the following error: 
JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document.

How can I read the results beginning from the JSON string like this:
{"responseData": {
"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\u003dcache:TwrPfhd22hYJ:en.wikipedia.org",
"title": "\u003cb\u003eParis Hilton\u003c/b\u003e - 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\u003dcache:1i34KkqnsooJ:www.imdb.com",
"title": "\u003cb\u003eParis Hilton\u003c/b\u003e",
"titleNoFormatting": "Paris Hilton",
"content": "Self: Zoolander. Socialite \u003cb\u003eParis Hilton\u003c/b\u003e..."
},
...
],
"cursor": {
"pages": [
{ "start": "0", "label": 1 },
{ "start": "4", "label": 2 },
{ "start": "8", "label": 3 },
{ "start": "12","label": 4 }
],
"estimatedResultCount": "59600000",
"currentPageIndex": 0,
"moreResultsUrl": "http://www.google.com/search?oe\u003dutf8\u0026ie\u003dutf8..."
}
}
, "responseDetails": null, "responseStatus": 200}


I would like to read the data in this way: 


Console.WriteLine(results(0).GsearchResultClass)
Console.WriteLine(results(0).unescapedUrl)
Console.WriteLine(results(0).title)
...
Console.WriteLine(results(1).GsearchResultClass)
Console.WriteLine(results(1).unescapedUrl)
Console.WriteLine(results(1).title)


Is it possible to achieve?
Coordinator
Oct 27, 2008 at 9:05 AM
That error message does not match up with your examples. There is no way you could have gotten it.