views:

83

answers:

2

When I send the following query

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=coffee%20New%20York%20NY

using c# WebClient.DownloadString function or ordinary web browser I get JSON data which is different from data for the same query using JavaScript and Google AJAX Search API.

From REST service I get the following url field

http://www.google.com/maps/place?source003duds0026q003dcoffee0026cid003d13245583795745066822

but from JavaScript query I get this url field

http://www.google.com/maps/place?source=uds&q=coffee&cid=13245583795745066822

The problem with REST service answer is that the url it gives points to a web page with error message "We currently do not support the location".

What am I doing wrong?

A: 

It looks like either you are decoding the URI from the REST request incorrectly, or Google is ending it wrong. The = are being sent or parsed as 003d and the & as 0026

EDIT : After trying that link I see they return the links, in the JSON, with the '=' and '&' encoded, the JavaScript must be replacing those characters for you automatically. You could do a simple String replace on "003d" and "0026" - although I'm not sure that will cover every use case.

Gandalf
A: 

I resolved this by parsing JSON data with Json.NET library http://json.codeplex.com/

robert_d