GROQ Query Playground
Run Sanity GROQ queries against pasted JSON in your browser. Filters, projections, order(), slices and reference joins with formatted output and syntax errors. No Sanity project, no upload.
Loading tool...
What is GROQ Query Playground?
GROQ Query Playground is an in-browser environment for running Sanity GROQ queries against your own JSON. It implements a focused subset of the GROQ language β filters, projections, order(), slices, arithmetic and reference joins β in pure JavaScript, so there is no Sanity project to configure and no data ever leaves your machine. Paste a dataset, type a query, and see exactly which documents a Sanity client would return.
Key Benefits
- Test GROQ queries instantly without a Sanity project or API token
- Privacy-first: documents are parsed and queried entirely in your browser
- Learn GROQ faster with preset queries covering the common patterns
- Syntax errors point at the exact character instead of failing silently
- Copy or download results as formatted JSON
Common Use Cases
- β’Prototyping a GROQ query before adding it to a Sanity client
- β’Debugging why an existing query returns unexpected documents
- β’Teaching a teammate GROQ projections and reference joins
- β’Checking how a dataset shape affects a query before a content migration
How to Use GROQ Query Playground
- Paste a dataset: Paste a Sanity API response or any JSON array of documents into the input box, or leave it empty to use the built-in sample dataset.
- Write a GROQ query: Type a query such as *[_type == "post"] and shape the result with a projection. The output updates as you type.
- Try a preset: Click a preset chip below the query box to load common patterns: projections, order(), slices, reference joins and count().
- Copy or download: Review the formatted JSON, then copy it to your clipboard or download it as a file.
Key Features
- Filters with ==, !=, <, <=, >, >=, in, match, && and ||
- Projections with aliases and spread, including nested array projections
- order() with multiple sort keys, plus [n], [0...3] and [0..3] subscripts
- Reference joins with the -> operator, resolved against the pasted dataset
- Built-in functions: count, length, defined, coalesce, select, references
- Syntax errors with a caret pointing at the exact character