Skip to content
XPath like notation for querying JSON (nested dicts and lists) data
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dpath
README.md
play.py

README.md

dQuery: XPath for querying nested data for Python

Uses funcy and pyparsing as dependencies.

There are some examples in dpath/tests.py

API is very fluid right now, but the general idea is like this:

data = [
    {"a": [3, 4, 5, {"z": 10}], "z": "zz"},
    {"b": "uj", "a": {"z": "az"}, "z": "zz"},
    ["argh", "asssert", "so", "on"],
]

assert query(data, "**/z") == ['zz', 10, 'zz', 'az']
You can’t perform that action at this time.