
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeBased on your data structure, the issue is that content is not a reference (it doesn't have _ref), it's a nested object. You can't use the dereference operator -> on regular objects, only on references.
Here's how to properly query your data:
*[_type == "stylist" && name == "Alex Clark"] {
name,
"services": content.services[]-> {
name,
// any other fields from the service document
}
}The key difference is:
content.services) to access fields inside nested objects->) only on the actual references inside the arrayIf you want to keep the entire content structure but expand the services, you can use the spread operator:
*[_type == "stylist" && name == "Alex Clark"] {
name,
content {
businessName,
emailAddress,
phoneNumber,
suiteNumber,
hours,
"services": services[]-> {
name,
// other service fields
}
}
}Or if you want to expand services while keeping all other content fields as-is:
*[_type == "stylist" && name == "Alex Clark"] {
name,
content {
...,
"services": services[]-> {
name
}
}
}The ... (spread operator) includes all fields from the content object, and then you override just the services array with the dereferenced version.
The fundamental rule here from the GROQ projections documentation: -> only works on references (objects with _ref), while dot notation traverses into regular nested objects. Your content object is just a regular nested object (even though it has _type: "object"), so you need to use content.services to access the array before dereferencing each item.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store