Utility to execute a query against a JavaScript oject