In the tutorial, there is samples of what the API returns as JSON. Is there a way to view these ?

11 replies
Last updated: Jan 11, 2021
In the tutorial, there is samples of what the API returns as JSON. Is there a way to view these ?
AI Update

Yes! There are several ways to view the JSON data that Sanity's API returns:

1. Vision Plugin (Built into Studio) The Vision plugin is a GROQ playground built right into Sanity Studio. It lets you write GROQ queries against your project's dataset and see the JSON results in real-time. This is probably the most convenient option if you're already working in Studio - you can test queries and inspect the exact JSON structure your API will return.

2. GROQ Arcade GROQ Arcade is a browser-based playground where you can practice GROQ queries on any JSON data source. It's great for experimenting and learning without needing to set up a project. You can quickly test how to filter, project, and transform JSON documents.

3. groq.dev There's also groq.dev, another browser-based playground specifically for testing GROQ queries.

4. Direct API Calls You can also make direct HTTP requests to Sanity's Query API endpoint and view the raw JSON responses. The endpoint format is:

https://<projectId>.api.sanity.io/v2021-10-21/data/query/<dataset>?query=<GROQ query>

If you're following a tutorial and want to see what the API returns, I'd recommend starting with the Vision plugin if you have Studio access, or GROQ Arcade if you want a quick standalone environment. Both will show you the exact JSON structure that Sanity returns for your queries.

Im not sure I 100% got the question but I think you want this:
https://www.sanity.io/plugins/vision
Ah cool, this is probably it once I figure out how to query
I really like the documentation btw, this is what will separate it from others and increase adoption imo
Just read it over, it makes a lot of sense, and surprisingly readable and intuitive
There's also https://groq.dev , which provides a few samples and lets you play around with the query to see what gets returned.
Awesome, i'll check it out!
Yeah. Have you found the hidden gem inside that webpage yet Geoff? There is a little secret put there by our CTO
btw little nit, the block comment doesn't work πŸ˜›
Magnus: No, I haven't. I'll have to take a look.
Ha! Very cool. My kids will like that.

Sanity – Build the way you think, not the way your CMS thinks

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.

Was this answer helpful?