https://github.com/simonw/datasette-jq
Datasette plugin that adds a custom SQL function for executing jq expressions against JSON values
https://github.com/simonw/datasette-jq
datasette datasette-io datasette-plugin jq
Last synced: 7 days ago
JSON representation
Datasette plugin that adds a custom SQL function for executing jq expressions against JSON values
- Host: GitHub
- URL: https://github.com/simonw/datasette-jq
- Owner: simonw
- License: apache-2.0
- Created: 2019-05-30T01:06:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-09T05:43:43.000Z (over 5 years ago)
- Last Synced: 2025-09-27T15:29:43.749Z (13 days ago)
- Topics: datasette, datasette-io, datasette-plugin, jq
- Language: Python
- Size: 10.7 KB
- Stars: 17
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# datasette-jq
[](https://pypi.org/project/datasette-jq/)
[](https://circleci.com/gh/simonw/datasette-jq)
[](https://github.com/simonw/datasette-jq/blob/master/LICENSE)Datasette plugin that adds custom SQL functions for executing [jq](https://stedolan.github.io/jq/) expressions against JSON values.
Install this plugin in the same environment as Datasette to enable the `jq()` SQL function.
Usage:
select jq(
column_with_json,
"{top_3: .classifiers[:3], v: .version}"
)See [the jq manual](https://stedolan.github.io/jq/manual/#Basicfilters) for full details of supported expression syntax.
## Interactive demo
You can try this plugin out at [datasette-jq-demo.datasette.io](https://datasette-jq-demo.datasette.io/)
Sample query:
select package, "https://pypi.org/project/" || package || "/" as url,
jq(info, "{summary: .info.summary, author: .info.author, versions: .releases|keys|reverse}")
from packages[Try this query out](https://datasette-jq-demo.datasette.io/demo?sql=select+package%2C+%22https%3A%2F%2Fpypi.org%2Fproject%2F%22+%7C%7C+package+%7C%7C+%22%2F%22+as+url%2C%0D%0Ajq%28info%2C+%22%7Bsummary%3A+.info.summary%2C+author%3A+.info.author%2C+versions%3A+.releases%7Ckeys%7Creverse%7D%22%29%0D%0Afrom+packages) in the interactive demo.