GROQ is a query language that lets you query, join, and transform JSON documents without having to create schemas, or resolvers. It’s the perfect tool for working with JSON data. You can quickly find objects from values in nested fields, rewrite keys in projections, and reorder objects in an array-based the values of properties. GROQ also has functions that let you count, select, and fall back on default values. It’s soooo versatile!
It used to be that GROQ was only available inside Sanity’s query engine. We announced the open sourcing of our query language GROQ at the JAMstack conference in London this summer. GROQ now ships as a JS library so it thrives both inside your apps and on the command line.
We think GROQ might be easier to learn and use than other tools out there and might make your JSON wrangling less unpleasant. Want a quick introduction? Check out our GROQ article on CSS-tricks.