
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeKia ora! Great to hear you're enjoying the simpler approach of getting image URLs directly in GROQ! For your array of objects with images, you can absolutely use the same syntax pattern - you just need to use GROQ's array projection syntax with the [] operator.
Here's how to grab the image URLs from your sponsors array:
*[_type == "yourDocumentType"] {
sponsors[] {
alt,
"imageUrl": image.asset->url,
url
}
}The key is using sponsors[] with curly braces to project what you want from each object in the array. The image.asset->url syntax works exactly the same way inside array projections as it does for top-level fields.
If you want to keep all the fields and just add the resolved URL, you can use the ellipsis operator:
*[_type == "yourDocumentType"] {
sponsors[] {
...,
"imageUrl": image.asset->url
}
}This keeps all your existing fields (alt, image, url) and adds the resolved imageUrl field.
Pro tip: Place the ellipsis (...) at the beginning of your projection to avoid accidentally overriding fields. So if you're being extra cautious:
sponsors[] {
...,
"imageUrl": image.asset->url
}No need to switch back to the URL builder for this case - the direct GROQ approach works perfectly fine for arrays! The syntax is just as clean and straightforward as what you've been enjoying with single images.
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