😎 Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

How to use a Query to Access Data in Array

3 replies
Last updated: Jan 17, 2023
Hi All, I am new here πŸ™‚ , I have got this schema, I need help with the query to access the data in the array
name: 'carousel',

type: 'document',

title: 'Carousel',


fields:[

{

name:'imgContainer',

type:'array',

of:[

{

name: 'image',

type: 'image',

},

]

},

],
Jan 17, 2023, 10:35 AM
After you deploy, because deploying is far more easier than using your own PC's resources, just create a document of this Schematype and hit Crtl+Alt+I to show you the object properties you can use in groq queries to access the data inside your schematype., Let me know if that helps.
Jan 17, 2023, 10:52 AM
*[_type == "carousel"]{
"images": imgContainer[] -> {
"image": image.asset -> url
}}
Jan 17, 2023, 10:58 AM
This just game an idea for my own project, thank you
Jan 17, 2023, 7:37 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?