jq Playground
Run real jq filters against JSON, using jq itself compiled to WebAssembly.
- Recent results are kept in this browser's local storage until you clear them.
History kept on this device
Recent results are kept in this browser's local storage until you clear them. - Processing happens in this page. No application server receives your input.
Runs in your browser
Processing happens in this page. No application server receives your input.
JSON input
Output
What this tool does
Run applies a jq filter to JSON text with the real jq engine, compiled to WebAssembly, and shows what jq writes. For example, .users | map(select(.active)) | length over {"users":[{"name":"a","active":true},{"name":"b","active":false},{"name":"c","active":true}]} counts the active users, and the output is 2.
Copy copies the output. Everything runs in your browser, and nothing in the input or the filter is sent anywhere.
What it does not do
There are no option fields such as -r, -c, -s or -n, no run as you type, no download, no saved filter library, and no partial output from a run that failed. Run runs when you press it, or press Enter in the filter field.
The engine
- The engine is 2.7 MB, and it downloads on first use, when you press Load engine. Nothing is fetched before that.
- Stopping a run discards the engine, and the next run loads it again, which needs the network until the cache and hosting work of steps 149 and 151.
- There is no automatic time limit, because a tool that kills a filter at a fixed time is worse than one that lets you decide. A run that writes nothing and never ends stops only by Cancel, which costs the engine and gives the tab back.
- A very deep program may stop the engine, and so may
delanddelpathsover a value nested from about 19 levels. The page then shows that the engine was stopped.
The dialect
inputandinputsread only later documents in the input box.$ENVandenvhold fixed placeholders, apart fromLANG, which follows the browser's language.includeandimportfail, because there is no filesystem.input_filenamereadsinputString, as jq's messages do.
Reading results
- A run that ends in an error shows no output from before the error, unlike the command line.
debugandstderrtext is not shown.- A repeated key keeps its last value, and a warning appears only for a single-document input.
- Numbers beyond 2^53 change under arithmetic.
- Input and output nesting stop at 32 levels, because this build cannot print deeper values correctly. A program that turns a deeper value into a string, through
tojson,tostring,@json, another@format, string interpolation orerror, may stop the engine or run until stopped, and a wrong string is not ruled out. This is risk reduction, not a guarantee. nowdiffers per run.
The filter field
A pasted filter's line breaks become spaces. One with a # comment is refused, because a comment runs to the end of the line and the field is one line. Text over the filter's limit is not pasted.
Limits
| Bound | Value | At the bound |
|---|---|---|
| Input | 16.0 MB | Refused before the engine is called |
| Filter | 2.0 KB | Refused before the engine is called |
| Output | 16.0 MB | The run is ended, with no partial output |
| Shown output | 262,144 characters | The box shows the first part, and says so |
| Message | 64.0 KB | Cut on a whole character, and says so |
| Nesting | 32 levels | Refused for input, ended for output |
The box shows the first part of a long output, and Copy copies all of it while the output is current. An edit or a new press puts the rest out of reach until the filter runs again.
Storage
The page keeps your input, filter and output across a reload when they fit in 131,072 characters together. An input and filter over that are not kept, and a larger output is kept only until you reload, with the input and filter kept if they fit. When storage is unavailable, every run still completes.
Scope: this covers the page itself. Your browser, operating system, clipboard, downloads, extensions, and crash recovery may keep copies, and a compromised site origin would not be protected.