I notice this question was asked a few years ago but if someone else find this, here are some newer projects trying to address this same problem:

  • ObjectPath (for Python and Javascript): http://objectpath.org/
  • jsonpath (Python reimplementation of the Javascript equivalent): https://pypi.org/project/jsonpath/
  • yaql: https://yaql.readthedocs.io/en/latest/readme.html
  • pyjq (Python bindings for jq https://stedolan.github.io/jq/): https://pypi.org/project/pyjq/
  • JMESPath: https://github.com/jmespath/jmespath.py

I personally went with pyjq because I use jq all the time for data exploration but ObjectPath seems very attractive and not limited to json.

Answer from Josep Valls on Stack Overflow
🌐
Python Land
python.land › home › data processing with python › json in python: how to read, write, and parse › jmespath python: json query language
JMESPath Python: JSON Query Language • Python Land Tutorial
January 28, 2022 - JMESPath is a query language for JSON. JMESPath in Python allows you to obtain the data you need from a JSON document easily.
Discussions

Python - Query JSON file for occurrences of key and create list of values

Have you tried Python's built-in JSON decoder?

import json
with open('your_file.json', 'r') as f:
  data = json.load(f)
# Now you have a Python dict with all of the information
# from the json file

So let's assume that the JSON file looks like this:

{
   'runs': [
      {'name': 'run1', 'time': 1000, 'distance': '35'},
      {'name': 'run2', 'time': 500, 'distance': '20'}
  ]

}

You could do

for run in data['runs']:
  print(run['distance'])
More on reddit.com
🌐 r/learnprogramming
7
1
May 25, 2016
Best method to query and search JSON in Python?
Are you using the built in json module? More on reddit.com
🌐 r/learnpython
3
1
October 1, 2021
Big Query JSON Validation
heres a bq schema validator in node https://github.com/holidayextras/jsonschema-bigquery More on reddit.com
🌐 r/bigquery
1
2
November 27, 2019
Simple GraphQL Client for Python

Thanks for sgqlc.

It would be nice if it provided help with pagination. I found it really cumbersome to do manually especially with more than one level.

More on reddit.com
🌐 r/Python
1
18
October 2, 2016
People also ask

Can JMESPath be used on HTML?

No, for that refer to very similar HTML path languages like CSS Selectors and Xpath Selectors.

🌐
scrapfly.io
scrapfly.io › blog › posts › parse-json-jmespath-python
Quick Intro to Parsing JSON with JMESPath in Python
What are some alternatives to JMESPath?

Some other popular query language for JSON are JsonPath, JQ and pyquery

🌐
scrapfly.io
scrapfly.io › blog › posts › parse-json-jmespath-python
Quick Intro to Parsing JSON with JMESPath in Python
What's the difference between [] and [*] in JMESPath?

The [] flattens all results while [*] keeps the structure as it is in the orignal dataset. See this example in Python:

data = {
  "employees": [
    {
      "people": [
        {"address": ["123 Main St", "California", "US"]},
        {"address": ["456 Sec St", "Nevada", "US"]},
      ],
    },
    {
      "people": [
        {"address": ["789 Main St", "Washington", "US"]},
        {"address": ["a12 Sec St", "Alaska", "US"]},
      ],
    },
  ]
}

jmespath.search("employees[*].people[*].address", data)
[
  # fromt he first group:
  [['123 Main St', 'California', 'US'], ['456 Sec St', 'Nevada', 'US']],
  # from the second group:
  [['789 Main St', 'Washington', 'US'], ['a12 Sec St', 'Alaska', 'US']]
]

jmespath.search("employees[].people[].address", data)
[
  # all groups merged:
  ['123 Main St', 'California', 'US'],
  ['456 Sec St', 'Nevada', 'US'],
  ['789 Main St', 'Washington', 'US'],
  ['a12 Sec St', 'Alaska', 'US']
]
🌐
scrapfly.io
scrapfly.io › blog › posts › parse-json-jmespath-python
Quick Intro to Parsing JSON with JMESPath in Python
🌐
GitHub
github.com › s1s1ty › py-jsonq
GitHub - s1s1ty/py-jsonq: A simple Python package to Query over Json Data
py-jsonq is a simple, elegant Python package to Query over any type of JSON Data.
Starred by 129 users
Forked by 21 users
Languages   Python 100.0% | Python 100.0%
🌐
Rittman Mead
rittmanmead.com › blog › 2024 › 05 › tip-tuesday-use-python-for-querying-json-files
Tip Tuesday | Use Python For Querying JSON Files
May 14, 2024 - To load the file in Python, only a few lines of code are required: import json with open("./data.json","r") as json_file: data = json.load(json_file) customers = data['customers'] The resulting "customers" variable is a list of dictionaries, analogous to a relational table, enabling SQL-like querying operations:
🌐
GitHub
github.com › jsonquerylang › jsonquery-python
GitHub - jsonquerylang/jsonquery-python: A lightweight, flexible, and expandable JSON query language · GitHub
This is a Python implementation of JSON Query, a small, flexible, and expandable JSON query language.
Starred by 54 users
Forked by 3 users
Languages   Python
Find elsewhere
🌐
PyPI
pypi.org › project › jsonquery
jsonquery
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
GeeksforGeeks
geeksforgeeks.org › python › working-with-json-data-in-python
Working With JSON Data in Python - GeeksforGeeks
3 weeks ago - JMESPath is a query language designed specifically for JSON data. It allows you to extract specific values from complex or nested JSON structures in a clean and readable way. For example, in normal Python access, you might retrieve a nested ...
🌐
Scrapfly
scrapfly.io › blog › posts › parse-json-jmespath-python
Quick Intro to Parsing JSON with JMESPath in Python
September 26, 2025 - Use jmespath python as the JSON equivalent of XPath/CSS selectors for extracting data from large JSON datasets · Parse hidden JSON data embedded in websites more efficiently than manual dictionary navigation · Apply JMESPath query expressions for complex data filtering, projections, and transformations
🌐
DEV Community
dev.to › r_elena_mendez_escobar › efficiently-querying-json-data-in-python-exploring-the-met-museums-artworks-31fj
Efficiently Querying JSON Data in Python: Exploring the MET Museum's Artworks - DEV Community
October 17, 2024 - The resulting result variable will contain only the specified fields, allowing us to focus on the desired information without needing to manually parse through the entire JSON object. In some cases, you may want to rename keys or adjust the output structure for clarity. With JMESPath, you can create aliases for keys to produce a more descriptive result, especially useful when dealing with nested data or similarly named fields. We can extend the previous example by assigning aliases to each field, making the output more readable and aligned with our analysis needs: query = """{ title_name: title, date: objectBeginDate, artist_name: constituents[0].name, tags_name: tags[*].term }""" result = jmespath.search(query, response) result
🌐
Python Land
python.land › home › data processing with python › json in python: how to read, write, and parse
JSON in Python: How To Read, Write, and Parse • Python Land Tutorial
January 13, 2023 - Learn how to read and parse JSON, read and write JSON to a file, and how to convert Python data types to JSON.
🌐
Thenybble
thenybble.de › posts › analyzing multi-gigabyte json files locally
Analyzing multi-gigabyte JSON files locally | thenybble.de
March 9, 2023 - I’ve had the pleasure of having had to analyse multi-gigabyte JSON dumps in a project context recently. JSON itself is actually a rather pleasant format to consume, as it’s human-readable and there is a lot of tooling available for it. JQ allows expressing sophisticated processing steps in a single command line, and Jupyter with Python and Pandas allow easy interactive analysis to quickly find what you’re looking for.
🌐
Python
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
2 weeks ago - If the data being deserialized is not a valid JSON document, a JSONDecodeError will be raised. Changed in version 3.6: All parameters are now keyword-only. ... Return the Python representation of s (a str instance containing a JSON document).
🌐
Real Python
realpython.com › python-json
Working With JSON Data in Python – Real Python
August 20, 2025 - Learn how to work with JSON data in Python using the json module. Convert, read, write, and validate JSON files and handle JSON data for APIs and storage.
🌐
DataCamp
datacamp.com › tutorial › json-data-python
Python JSON Data: A Guide With Examples | DataCamp
December 3, 2024 - No schema enforcement: JSON files do not enforce any schema, which means that it is possible to store inconsistent or invalid data in a JSON file. This can lead to errors and bugs in applications that rely on the data in the file. Limited query and indexing capabilities: JSON files do not provide the same level of query and indexing capabilities as traditional databases.
🌐
Zyte
zyte.com › home › blog › json parsing with python [practical guide]
JSON Parsing with Python [Practical Guide]
July 6, 2023 - When traversing JSON data in Python, depending on the complexity of the object, there are more advanced libraries to help you get to the data with less code. JMESPath is a query language designed to work with JSON data. It allows you to extract ...
🌐
Bobdc
bobdc.com › blog › pythonjson
Parsing JSON with Python
December 15, 2024 - My sample demo data to parse is pretty close to the test input that I used when I wrote about JSON2RDF: { "mydata": { "color": "red", "amount": 3, "arrayTest": [ "north", "south", "east", "escaped \"test\" string", "west" ], "boolTest": true, "nullTest": null, "addressBookEntry": { "givenName": "Richard", "familyName": "Mutt", "address": { "street": "1 Main St", "city": "Springfield", "zip": "10045" } } } } ... #!/usr/bin/env python3 import json f = open('jsondemo.js') data = json.load(f) print(data["mydata"]["color"]) print(data["mydata"]["amount"]) # Pull something out of the middle of an ar
🌐
GeeksforGeeks
geeksforgeeks.org › python › read-json-file-using-python
Read JSON file using Python - GeeksforGeeks
We can handle common errors while reading JSON using try-except blocks to make our code more reliable, maintainable and production-ready. This error occurs when Python cannot locate the JSON file you are trying to read.
Published   September 15, 2025
🌐
W3Schools
w3schools.com › PYTHON › python_json.asp
Python JSON
JSON is text, written with JavaScript object notation. Python has a built-in package called json, which can be used to work with JSON data.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Core › Scripting › JSON
Working with JSON - Learn web development | MDN
Now that we've retrieved the JSON data and converted it into a JavaScript object, let's make use of it by writing the two functions we referenced above. First of all, add the following function definition below the previous code: js · function populateHeader(obj) { const header = document.querySelector("header"); const myH1 = document.createElement("h1"); myH1.textContent = obj.squadName; header.appendChild(myH1); const myPara = document.createElement("p"); myPara.textContent = `Hometown: ${obj.homeTown} // Formed: ${obj.formed}`; header.appendChild(myPara); } Here we first create an h1 element with createElement(), set its textContent to equal the squadName property of the object, then append it to the header using appendChild().
🌐
Django Documentation
docs.djangoproject.com › en › 5.2 › topics › db › queries
Making queries | Django documentation | Django
Whichever of the values is stored, ... the Python representation of the JSON scalar null is the same as SQL NULL, i.e. None. Therefore, it can be hard to distinguish between them. This only applies to None as the top-level value of the field. If None is inside a list or dict, it will always be interpreted as JSON null. When querying, None value ...