Reputation: 58
I want to create an app that list items, that get by search in google map. Its only for display particular details about near hospital. I don't know how to convert map result into json object
I am beginner in android development
Upvotes: 0
Views: 3229
Reputation: 4950
The Google Maps API provides these web services as an interface for requesting Maps API data from external services and using them within your Maps applications.
These web services use HTTP
requests to specific URLs
, passing URL parameters as arguments to the services. Generally, these services return data in the HTTP request as either JSON or XML for parsing and/or processing by your application.
A typical web service request is generally of the following form:
https://maps.googleapis.com/maps/api/service/output?parameters
where service indicates the particular service requested and output indicates the response format (usually json or xml)
.
JSON (Javascript Object Notation)
has an obvious advantage over XML in that the response is lightweight. Parsing such a result is trivial in JavaScript as the format is already a valid Javascript object. For example, to extract the value of the 'formatted_address' keys within a JSON result object, simply access them using the following code:
for (i = 0; i < myJSONResult.results.length; i++) {
myAddress[i] = myJSONResult.results[i].formatted_address;
}
Upvotes: 1
Reputation: 312
Use this to search places from google maps
String placesSearchStr = "https://maps.googleapis.com/maps/api/place/nearbysearch/" +
"json?location="+lat+","+lng+
"&radius=1000&sensor=true" +
"&types=hospital"+
"&key=your_key_here";
Upvotes: 1