jmespath / jmespath.py

JMESPath is a query language for JSON.

Home Page:http://jmespath.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help: Searching the region name if it contains a city name in geoname.org JSON files

RSwarnkar opened this issue · comments

Hello there, I am using jmespath for python 3.x. I am trying to create a query that would return the array of name attribute of region if it contains a specific 'city'. Here is the schema of the JSON.

{
 country-name
 country-code
 regions[
   {
    region-name 
	region-code 
	cities[
	    {city-name, city-lat, city-long},
		{city-name, city-lat, city-long},
	]
   },
   
    {
    region-name 
	region-code 
	cities[
	    {city-name, city-lat, city-long},
		{city-name, city-lat, city-long},
	]
   }
 ]
 }

IN.json.txt

Attaching a sample JSON from Geonames.org for country=India, city=Rampur.