Use Fragments
{
"query": {
"book": {
"@id": "2",
"name": "",
"...author": ""
}
},
"...author": {
"author": {
"name": ""
}
}
}
We define fragments by prepending ...
before the name and placing them at the root of the query. The result will be like:
{
"query": {
"book": {
"author": {
"name": "First Author"
},
"name": "Second Book"
}
}
}