---
title: JSON Query Syntax
---
ParadeDB also supports writing query builder functions as JSON objects.
This is useful for programmatic generation or client applications that construct search queries as structured JSON.
To write a query as JSON, first call `SELECT` on the desired query builder function, which returns its JSON
representation:
```sql
SELECT pdb.regex('key.*');
```
```csv
regex
-------------------------------
{"regex":{"pattern":"key.*"}}
(1 row)
```
Next, paste this JSON string into the right-hand side of the `@@@` operator and cast it to `pdb.query`:
```sql
SELECT description, rating, category
FROM mock_items
WHERE description @@@
'{
"regex": {
"pattern": "key.*"
}
}'::pdb.query;
```
The JSON query object must be explicitly cast to `pdb.query` using
`::pdb.query`.