Nuxt.js quickstart
Querying content with GROQ
Content from Sanity is typically fetched as JSON from your hosted dataset using the GROQ query language.

1Write your first GROQ query
Open Vision in your Studio's top nav bar and paste this query into the Query code block field.
*
represents all documents in a dataset as an array[_type == "post"]
represents a filter to only return matching documents{ _id, title, slug, publishedAt }
represents a projection which defines the attributes from those documents that you wish to include in the response.
*[_type == "post"]{
_id,
title,
slug,
publishedAt
}
2Run the query
Click Fetch to see the JSON output in Results. You should see the document you previously published in the results.
Queries run in Vision use your authenticated session, so you will see private documents – which have a .
in the _id
key, like drafts.
. You will not see when queried from your front end in the next step.
Was this page helpful?