Hash Maps / Dictionaries in a N1QL Query

You have provided partial expression and it is hard to understand. It looks like too complex. If you can provide sample document , sample query parameter and what you want achieve will see any better way to do this.

Couchbase already provides dictionary and map access in the N1QL. Required dot before array bracket. Checkout link below for explanation.

select tt.["James"] from {
  "James": 9001,
  "Jo": 3474,
  "Jess": 11926
} tt