I found this question about SQL-like query libraries. What I am looking for is a library that allows queries on JSON objects, embedded in a client-side application (browser), as well as from a remote high performance dedicated database.
For the sake of completeness I'll throw out PouchDB and CouchDB.
Pouch for client side: http://pouchdb.com/ Couch for server side: http://couchdb.apache.org/