Skip to content

Renaming default results structure #1764

Answered by yorek
BumpaRoy asked this question in Q&A
Discussion options

You must be logged in to vote

Hi BumpaRoy

It is not possible to change to name items to something else in the GraphQL query, but if you need to have the items element using another name in the returned result, you can use aliasing to do that. For example:

query {
  customers {
    contacts: items  {
      CustomerID
      Title
      FirstName
      LastName
      EmailAddress
    }
  }
}

would return the following result:

{
  "data": {
    "customers": {
      "contacts": [
        {
          "CustomerID": 1,
          "Title": "Mr.",
          "FirstName": "Orlando",
          "LastName": "Gee",
          "EmailAddress": "[email protected]"
        }
      ]
    }
  }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by seantleonard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants