Understanding the difference between GROQ and GraphQL query languages for JSON.

6 replies
Last updated: Jul 23, 2020
ah, now I really don’t understand the advantage of GROQ over GRAPHQL
Jul 23, 2020, 8:11 PM
You can think of GraphQL as REST and GROQ as SQL. The former is more of a API pattern, the latter is a query language for JSON. They do some of the same things, but the latter is more versatile in terms of what you can do. We use GROQ to power the GraphQL API for example.
Jul 23, 2020, 8:15 PM
There’s so many different query languages already.
Jul 23, 2020, 8:24 PM
I understand there is a spec for GROQ, but nobody else is using it.
Jul 23, 2020, 8:25 PM
afaik
Jul 23, 2020, 8:25 PM
Yup, there are, but this one is for JSON documents 🙂
And it’s fairly new, but are being adopted outside of Sanity as well.
Jul 23, 2020, 8:28 PM
But no pressure – you can use GraphQL if you prefer that, many do!
Jul 23, 2020, 8:28 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?