Selected nested values and their result representation

Let’s say I have the following document model:

{
   "parent":{
      "lastname":"smith",
      "firstname":"bob"
   },
   "child":{
      "lastname":"smith",
      "firstname":"billy"
   }
}

Is there a way to do a select parent.lastname, child.lastname ... and get back something like

{
   "parent":{
      "lastname":"smith"
   },
   "child":{
      "lastname":"smith"
   }
}

versus: select parent.lastname as pl, child.lastname as cl ...

{
    "pl":"smith",
    "cl":"smith"
}

Many Thanks,
Todd

FYI

SELECT OBJECT_REMOVE(a.parent,"firstname") as parent, 
       OBJECT_REMOVE(a.child,"firstname") as child
  FROM default a 

@atom_yang
Thanks for the response. The sample document model is oversimplified and does not represent the actual document model. Furthermore, being JSON and extensible, I don’t know what fields to remove only what fields to ask for.

Thanks again,
Todd

may be you can find some useful object function here, FYI
https://developer.couchbase.com/documentation/server/5.1/n1ql/n1ql-language-reference/objectfun.html

You can construct object whichever way you want.

SELECT { parent.lastname} AS parent, {child.lastname} AS child FROM default;