# pip install tinydb
from tinydb import TinyDB, Query, where
db = TinyDB('db.json')
# insert some data
db.insert({'name': 'Leonid', 'age': 23})
db.insert({'name': 'Miro', 'age': 32})
db.insert({'name': 'Mihaela', 'age': 19})
# Two ways to query
# 1
print(db.search(where('age')> 20))
#2
Person = Query()
print(db.search(Person.name == 'Leonid'))