
repo: All events belong to a repository.actor: Someone must have triggered the event.Typically any data set has some kind of identifying key. It’s important to first understand the high-level structure. If not, have a look at the JSON keys and what value they typically contain.įor the GitHub events API you can have a look at the detailed documentation. If you’re lucky to have access to the API or data format documentation like we do now, this is the perfect time to familiarize yourself with the format.
JQ QUERY FREE
Of course, you’re free to directly pipe the output of the curl directly to jq. If you want to experiment I’d suggest you do this too, so that not on every execution your data changes. We’ll be using the events.json file as example throughout this blog post.

# store the most recent 30 events on GitHub to a file To do so, let’s create a file called events.json from the endpoint: That allows you to experiment with the jq commands while you can still inspect the data in a text editor. To try out the commands shown in this blog post fetch a snapshot of the endpoint (as it’s output is constantly changing) and work on the file. To get a feeling of the data we’re now digesting feel free to open the events endpoint in your browser: GitHub Event API JSON That’s why the examples in this blog post will make use of the publicly available GitHub events API to parse some complex and nested JSON data. Most jq examples contain trivial JSON and data structures. This blog post shows 5 useful jq commands that you really need to know. Looking at the documentation however reveals an overwhelmingly huge number of options, functions and things you can do with jq. Jq offers a broad range of operations to transform and manipulate JSON based data structures from the command line. Lucky, there is jq, a command-line JSON processor. However, working on the CLI with JSON is still hard using traditional CLI tooling. It’s lightweight, human-readable (in theory) and supported by all major languages and platforms. If an output value contains decimal, it is categorized as Double.JSON has become the de facto standard data representation for the web.String, Integer, Double, Boolean, Array of any of the primitive listed above.This can be a variable or be a constant string.Įach output variable identified from running JQ filter on JSON Template will be added as a row, allowing the parsed member to be assigned to a variable. The source of the JSON string when the trigger action is executed. The following describes the Input tab for

When this is set to True, the raw result of the query will be returned in output variable “Raw String”. This is used to render the correct Output Variables. This indicates that the output of JQ Query will result in an Object. Sample JSON string which contains same data structure as the expected JSON when the trigger action is executed.Ĭurrently only Support Object. For information on obtaining and installing the extension, see Technology Preview Extension. This action is part of the Technology Preview Extension, which is also referred to as the sandbox package. The Decode JSON action is part of the Technology Preview Extension Read more about what you can do with JQ at. JQ is a parser utility for JSON data, you can use it to slice, filter, map, and transform structured data. The JQ Query action parses a JSON string and populates the identified variables using JQ Library.
