About This File
Create / Test / Learn JSON Processing
jqPlayground is an interactive, AutoIt, jq-based, playground for creating and testing JSON filters/queries for processing JSON datasets. 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.
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.
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:
JqExePath=<full path to jq exe>
jq-win32.exe or jq-win64.exe in the script directory.
- jq.exe in the script directory.
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 want. Then, either press the RUN button or Ctrl+Enter 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 dropdown 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 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 the 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.
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.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.
- Clear (ALT+C): Clear all fields
- 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.
- Added a button to load input/JSON from a file.
- Run (Ctrl+Enter or F5)
- Load (Alt+L)