-1

I know if my data is coming like

{
id: 123
address: xyz
name: hello

}

and I want to alias name during Query I can do it like

query {
 identification: id
 address 
 full_name : name

}

So my data will look like this:

{

  identification: 123
  address: xyz
  full_name: hello

}

but I want my upcoming data to look like this:

{

  id : 123
  info: {
     address: xyz
     name: hello
   }
  

}

How can I achieve this within GraphQl Query only how can I give alias info

xoxocoder
  • 204
  • 1
  • 10

2 Answers2

3

There is no GraphQL syntax that would allow you to do that client-side. Either apply the transformation programmatically inside your client code, or else change your schema on the server to reflect the data structure you need.

Daniel Rearden
  • 58,313
  • 8
  • 105
  • 113
0

No, you cannot do this. GraphQL alias can only change name of a field.