Stripping outer json structure off of response


#1

I am querying an object in an array and trying to just get the subdocument. I am using a query like:

SELECT array[0] from bucket USE KEYS ‘DOCUMENT ID’;

What gets returned in a response like:

[
  {
    "$1": {
      "a": 1,
      "b": 2,
      "c": 3
    }
  }
]

Is there are way to remove the extra “$1” level that is getting added? I would like it to return just the subdocument so that I can pass it directly to Jackson and not do any extra processing. So I would like it formatted like:

[
  {
    "a": 1,
    "b": 2,
    "c": 3
  }
]

#2

Hi @matt.dehring, try to navigate the object to the next level (using . operator)

SELECT array[0].* from bucket USE KEYS ‘DOCUMENT ID’;`

For example,
select schedule[0].* from `travel-sample` where type = “route” limit 2;
[
{
“day”: 0,
“flight”: “AF198”,
“utc”: “10:13:00”
},
{
“day”: 0,
“flight”: “AF248”,
“utc”: “21:24:00”
}
]