Nawap
Nawap

Reputation: 55

Is it possible to query nested json object using TinyDB

I have JSON file having following structure

{  
     "type":[  
        "apple-shimle",
        "king"
     ],

     "json-object":{  
        "test":"hi"
     }
  }

How to search for test == "hi" using TinyDB python only. Iam able to fetch "json-object" using search() but not "test".

Upvotes: 2

Views: 866

Answers (1)

timo.rieber
timo.rieber

Reputation: 3867

As from the docs you can query nested fields like this:

db.search(Check['json-object']['test'].exists())

Upvotes: 0

Related Questions