What Is GROQ Query Language?
IntermediateQuick Answer
TL;DR
GROQ (Graph-Relational Object Queries) is an open-source query language for filtering, projecting, and joining JSON documents. Created by Sanity, it works without a predefined schema — you query documents by their shape, not a declared type system. GROQ is concise, readable, and purpose-built for content APIs where documents have varied and nested structures.
Key Takeaways
- GROQ is schema-agnostic — queries work against any JSON document structure without upfront type declarations
- The filter syntax (`*[_type == "post"]`) and projection syntax (`{title, slug, body}`) are the two core building blocks
- GROQ supports joins, conditionals, ordering, slicing, and aggregations — all in a single expression