An alternative approach is to use XPath-inspired DSLs that work on JS or JSON object structures. These tend to work on strings, rather than declarative query objects. Examples:
JSPath: https://github.com/dfilatov/jspath
JSONPath: https://github.com/s3u/JSONPath
(Since you don't have type safety in JS, I don't think you lose much by using strings, unless you want to wrap it in TypeScript.)