
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeBased on your GROQ query, it looks like you're working with nested arrays of references - specifically dereferencing artworks and then dereferencing artists within each artwork. Your syntax looks correct! Let me explain what's happening and address any potential considerations.
Your query structure:
"artworks": artworks[]->{..., "artists":artists[]->{name},"image":image.asset->url}This is doing several things:
artworks[]-> - dereferencing each item in the artworks array"artists":artists[]-> - dereferencing each artist reference within that artwork"image":image.asset->url - dereferencing the image assetThis nested dereferencing pattern is perfectly valid in GROQ. The reference access operator (->) works with arrays and can be nested as you're doing.
A few things to keep in mind:
Performance: Each -> operator performs an internal subquery, so deeply nested references can impact query performance. With artworks[]-> and then artists[]-> inside, you're potentially making many subqueries if you have lots of artworks with multiple artists each.
Syntax variation: You could also write the artists dereferencing in a slightly different way:
"artists": artists[]->{name}
// or if you want just the names as a flat array:
"artists": artists[]->nameThe second form (artists[]->name) gives you a flat array of names directly, while your current syntax (artists[]->{name}) gives you an array of objects each with a name property.
Common issues to check:
type: 'reference'_key properties exist on array items if you're updating them (required for objects in arrays)Your GROQ syntax looks correct, so if you're experiencing specific issues, they're likely related to the data structure or schema configuration rather than the query syntax itself. What specific problem are you running into?
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