Skip to main content

Query JSON in memory as though it were a Mongo database.

Project description

j q u e

Query JSON in memory as though it were a Mongo database



pip3 install jque


import jque

jque accepts a variety of inputs to the constructor.

Pass a list of dicts:

data = jque.jque([{ "name": "jque" }])

Pass a JSON filename:

DATAFILE = "~/my/big/data.json"
data = jque.jque(DATAFILE)

Now you can query this dataset using Mongo-like syntax:

data.query({ "name": {"$neq": "numpy"} })

Arguments to query:

Arg Description
wrap (boolean : True) Whether to wrap the resultant dataset in a new jque object. This allows chaining, like jque.query(...).query(...), if you're the sort of person to do that. Pass False to get back a list instead.

data = jque.jque([{
    "_id": "ABC",
    "name": "Arthur Dent",
    "age": 42,
    "current_planet": "earth"
}, {
    "_id": "DE2",
    "name": "Penny Lane",
    "age": 19,
    "current_planet": "earth"
}, {
    "_id": "123",
    "name": "Ford Prefect",
    "age": 240,
    "current_planet": "Brontitall"

teenage_earthlings = data.query({
    "current_planet": {"$eq": "earth"},
    "age": { "$lte": 20, "$gte": 10 }

Use Python lambdas as a filter:

libraries = jque.jque([{"name": "jque", "language": "Python"}, {"name": "react", "language": "node"}])
list(libraries.query({ 'language': lambda x: x[:2] == "Py" }))

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
jque-0.1.2-py2.py3-none-any.whl (3.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3
jque-0.1.2.tar.gz (4.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page