Suhayb Kharabsheh Suhayb Kharabsheh - 17 days ago 7
JSON Question

Querying Geonames API to get only city country name

Too much useless json data is being fetched when I request a specific country cities by hitting this URL:

http://api.geonames.org/searchJSON?username=ksuhiyp&country=us&maxRows=1000


This returns too many json fields as you can see, question is hot to play with the query to get only city, country name ?

Answer

You can try with the additional parameter style=SHORT

http://api.geonames.org/searchJSON?username=ksuhiyp&country=us&maxRows=1000&style=SHORT

The docs says: style, String SHORT,MEDIUM,LONG,FULL (optional), verbosity of returned xml document, default = MEDIUM