@OBJECT Directive

The @object directive can be used to explicitly shape the nested object as an object.

The directive @object takes no arguments.

SELECT JSON_SERIALIZE(data PRETTY) AS data FROM GRAPHQL('
    driver {
        driverId: driver_id
        driverName: name
        driverPoints: points
        teamDetails: team @object {
            teamId: team_id
            teamName: name
            teamPoints: points
        }
    }
');
The above example explicitly defines that the field teamDetails must an object with subfields: teamID, teamName and teamPoints in the output:
DATA                                                                           
--------------------------------------------------------------------------------
{                                                                              
  "driverId" : 101,                                                            
  "driverName" : "Lando Norris",                                               
  "driverPoints" : 282,                                                        
  "teamDetails" :                                                              
  {                                                                            
    "teamId" : 301,                                                            
    "teamName" : "McLaren Mercedes",                                           
    "teamPoints" : 666                                                         
  }                                                                            
}                                                                              
                                                                                 
{                                                                              
  "driverId" : 102,                                                            
  "driverName" : "Oscar Piastri",                                              
  "driverPoints" : 384,                                                        
  "teamDetails" :                                                              
  {                                                                            
    "teamId" : 301,                                                            
    "teamName" : "McLaren Mercedes",                                           
    "teamPoints" : 666                                                         
  }                                                                            
}           
....................
....................
20 rows selected.
You can use the limit argument with @object directive that would limit the number of objects in the output to the specified limit:
SELECT JSON_SERIALIZE(data PRETTY) AS data FROM GRAPHQL('
    team (limit: 5) {
        teamId: team_id
        teamName: name
        teamPoints: points
        driver (limit: 1) @object {
            driverId: driver_id
            driverName: name
            driverPoints: points
        }
    }
');

The limit argument in the above example will only produce 5 rows since the team object is limited to 5:

DATA                                                                           
--------------------------------------------------------------------------------
{                                                                              
  "teamId" : 301,                                                              
  "teamName" : "McLaren Mercedes",                                             
  "teamPoints" : 666,                                                          
  "driver" :                                                                   
  {                                                                            
    "driverId" : 101,                                                          
    "driverName" : "Lando Norris",                                             
    "driverPoints" : 282                                                       
  }                                                                            
}                                                                              
                                                                                 
{                                                                              
  "teamId" : 302,                                                              
  "teamName" : "Ferrari",                                                      
  "teamPoints" : 652,                                                          
  "driver" :                                                                   
  {                                                                            
    "driverId" : 103,                                                          
    "driverName" : "Charles Leclerc",                                          
    "driverPoints" : 312                                                       
  }                                                                            
}           
...............................
...............................
5 rows selected.