
Learn to parse json data on Unix/Linux using the jq command, compare with grep and awk, and apply jq in Bash shell scripts for cloud and API workflows.
Install the jq command on Unix or Linux by switching to root, running yum update, installing jq, and verifying with jq --version, and note Windows with Chocolatey and docker options.
Enable Windows Subsystem for Linux, install Ubuntu or CentOS via Microsoft Store, verify with wsl -v, and set the default distribution in PowerShell for seamless Linux on Windows.
Learn jq command syntax to parse json data using filters, functions, and conditions. Understand optional options and flexible input, including files, json strings, or commands that produce json.
Master identity and field filters in jq to validate json and extract values. Use dot notation to access keys like name and first, and chain keys for nested objects.
Learn to read non-json data with jq using raw string options: use -R to read raw input and -r to strip quotes, while exploring additional jq options.
Combine multiple json field filters in one jq command using a comma, retrieving values like gender and name.last from sample.json; remove quotes with the -r option for clean output.
Learn how to sort json object keys alphabetically with jq -S, using an identity filter, and redirect sorted output to a new file, noting that in-place edits are not available.
Combine multiple json files with jq -s to produce a single array, where each file contributes one value; you can redirect the result to a new file.
Learn how to pass json data to jq from a file, command output, or json array or object using either here-string with <<< and $(...), or a pipeline.
Learn to parse API responses with curl and jq, using identity and field filters to extract the info key from JSON and handle success or failure in shell scripts.
Learn to parse aws cli and kubectl outputs with jq by converting command results to json and applying field filters to extract data such as cluster names.
Use jq's iterator filter to print one value at a time from a JSON array, whether top-level or under a key, including arrays of strings or objects.
Learn how to use jq iterator filter with array indices, including positive and negative indexes, to slice and select specific values or subarrays from json arrays.
Learn to construct JSON data types—null, number, string, and boolean—with jq without input using the -n option, and understand when to use quotes for strings and booleans.
Learn to build a JSON array with jq without input JSON data, using empty brackets for an empty array and adding values to populate it.
Explore jq basics by using --tab and -c options to control indentation and output format, including tabbed indentation, compact mode, and option priority when combining flags.
Discover two jq methods to add or modify a key value in a json object using the equal symbol and dot notation, including nulls, strings, numbers, arrays, and objects.
explore adding and modifying values in a json array with jq using two syntaxes: index-based updates and the plus equals approach, including array length and object key scenarios.
Learn how to recreate an object in jq by building a new object from selected input keys and values, using a shortcut to extract specific key-value pairs.
Discover how to check exit status with the dollar question mark, and use jq -e to fail a script when a json key fetch fails.
Store the jq command output into a shell variable, extract fields from sample json with dot notation, and assign results using the $(...) syntax; include -e to check command status.
Discover how to combine multiple jq command logics into one command using pipes, chaining field filters like .name and .title with functions such as length, and iterating over json arrays.
Learn to create a json array with jq by extracting user name values from each object in iam users.json, using filters and square brackets to output the array.
Explore using jq functions to parse JSON data, learn the general syntax, case sensitivity, and avoiding a dot before functions, then apply keys and length to objects, arrays, and strings.
Apply min, max, add, sort, reverse, and unique functions of jq to arrays of numbers, using direct input or a file, and learn sorting options including descending order.
Learn to manipulate arrays of objects using reverse, min_by, max_by, sort_by, group_by, and unique_by, applying id and usage keys for filtering, sorting, grouping, and deduplication.
Use jq's env function to access os level environment variables and custom variables as strings, retrieve keys like user or home, and export variables for multi-variable access.
Develop a shell script that displays json data using the jq command, incorporating environment variables like user and home, and exporting a custom Java version for robust output.
Use the --arg option to define and pass environment and custom variables to jq commands, access them with $VAR, and build objects or arrays from command output.
This course is for anyone who works with JSON on Unix/Linux Command-line or using Bash Shell Scripts.
Currently, DevOps Automation is more into REST APIs usage and REST APIs Response is JSON. So, to implement bash shell scripts by using REST APIs then you must know how to parse the response of REST API (I.e, parsing JSON Data).
JQ is a command-line utility developed to Parse JSON data. Parsing JSON Data is nothing but - Reading, Writing and Modifying the JSON Data.
We can also parse JSON Data with sed, awk, or grep commands but these are not perfect utilities to Parse JSON Data because we have to write more complex logic to work with JSON Data,
Its very easy to work with JSON Data using Jq Command. JQ supports filters, function, conditions, operators, and other language features.
What You Will Learn here:
Learn the basics of Jq
Explore how to Parse (read and write) JSON Data with Jq Command
Learn how to use Jq Command in Bash Shell Scripting
Find out how to pretty print json in the command line
Learn to use different type of filter on JSON Data
Discover how to use Jq select function with iterator filter and map function
Prerequisites
Linux/Mac System to Practice
Knowledge on Command Line
Basic Knowledge on Usage of Pipelines and redirections
Basic Knowledge on JSON Data