About This File
Create / Test / Learn JSON Processing
jqPlayground is an interactive, jq-based, tool created using AutoIt. The purpose of the tool is to help in the creation, testing, and understanding of JSON filters/queries used in the processing of JSON datasets. Internally, it uses the jq UDF for all JSON processing. The dot and bracket notation access in jq is similar to other existing AutoIt JSON parsing UDFs and tools. Therefore, jqPlayground can be used as a general purpose testing & learning tool, regardless of the ultimate UDF or utility you choose to use. jqPlayground comes with numerous examples to help you see and understand how it can be used for simple parsing and much more advanced JSON processing. You can modify and play with the example filters or you can create and test your own.
CONFIGURATION
The only requirement needed to run jqPlayground is that it can find a jq executable. jq executables can be downloaded on the jq Home Page, the jq Downloads page, or as a part of my jq UDF in the AutoIt Downloads section. As of v1.3.0, the latest jq executables are included in the zip file.
jqPlayground will look for the jq executable in the following order of precedence:
-
If a jqPlayground.ini file exists in the script directory, it will get the path to the jq executable under to following section and key:
[CONFIG]
JqExePath=<full path to jq exe>
-
jq-win32.exe or jq-win64.exe in the script directory.
- jq.exe in the script directory.
USAGE
The interface is pretty simple and straight forward. Paste or write whatever JSON you want to play with in the INPUT section. Write whatever parsing or processing filter(s) you want to test in the FILTER section. If necessary, you can select or enter any jq-specific flags you may want or need. Then, either press the RUN button, Ctrl+Enter, or F5 to execute your filter. You will see the output in the OUTPUT section. If you command was not successful, you will see the error message generated by jq.
There are also numerous examples that can be selected from EXAMPLES drop-down list. Upon selecting an example, it populates the filter, flags, and input as necessary. It then executes the example, showing the output in the OUTPUT section. The examples use one of 2 JSON datasets. BOOKS is a small, simple, JSON dataset that contains a catalog of book information. The NFL JSON dataset is much larger and complex. It is a snapshot of NFL game information during week 1 of the 2018 regular season. Some of the NFL JSON dataset examples really show off the speed and processing capabilities of jq.
If you want to dump the full path of every scalar JSON value in your JSON dataset, you can type "dump" in the FILTER section and press Ctrl+Enter, F5, or the RUN button. The output is the same as the jqDump() function in the jq UDF. "Dump" is not a jq filter command. It is a special command that I added to help those new to JSON understand how to access a given JSON value using dot-notation.
Lastly, in the bottom right area of the window, you can see the time it took to execute your filter. Because jqPlayground uses the jq UDF for all of its processing, the times you see are the times you can expect when using the jq UDF in your scripts.
USEFUL LINKS
jq Home Page: https://stedolan.github.io/jq
jq Manual: https://stedolan.github.io/jq/manual/
jq Downloads: https://stedolan.github.io/jq/download/
jq Tutorial: https://stedolan.github.io/jq/tutorial/
jq Wiki: https://github.com/stedolan/jq/wiki
Edited by TheXman
What's New in Version v1.3.0
Released
v1.3.0
- Added a "Paste" button to easily paste copied data into the JSON/Input section.
- Added mouse-over hints to the flags and the section headers. The hints for the flags show the actual command-line flags. The hints for the section headers, show the estimated maximum character limits of those particular sections.
- Slight changes to the order of the entries in the Help menu. I also made F1 go to jq's online documentation page.
- The jq executables (jq-win32.exe & jq-win64.exe) are now included in the zip file. That eliminates the need to download them if you don't already have them or aren't using the jq UDF (which also includes the executables). Basically, having the executables in the jqPlayground folder already, makes jqPlayground ready-to-use immediately after unzipping the files to a folder.
v1.2.0
- Added a menu option to restore last session.
- Added additional examples
- Added links to the jqPlayground & jq UDF pages to the Help menu.
-
New hotkey
- Clear (ALT+C): Clear all fields
v1.1.2
- Added Base64 encode/decode examples
- Change min/max/avg example to use string interpolation instead of concatenation.
- Added the online jq Manual, FAQ, and Cookbook to the Help menu.
v1.1.1
- Added a button to load input/JSON from a file.
-
New hotkeys
- Run (Ctrl+Enter or F5)
- Load (Alt+L)