Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Introduction to jq - Lightweight and Flexible Command-Line JSON Processor

SAP via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore the lightweight and flexible command-line JSON processor jq in this comprehensive one-hour tutorial. Learn how to use jq with the BTP Setup Automator, btp CLI, and other tools. Dive into topics such as JSON streams, command-line options, filter expressions, data manipulation, and formatting. Gain practical experience with realistic JSON data obtained from the btp CLI. Master techniques like mapping, filtering, sorting, and transforming data structures. Discover how to produce flat lists, use formatters, and perform advanced operations like grouping and object addition. Perfect for developers looking to enhance their JSON processing skills and streamline their workflow with powerful command-line tools.

Syllabus

Welcome and introduction
Using the BTP Setup Automator container image for easy access to all the tools incl. jq, ijq and more
Taking a look at some of the jq command line options via jq --help
Starting with jqterm for our session
Considering valid JSON values
Thinking about streams of JSON values
Looking what slurp -s does for us
Considering raw input -R for non-JSON values
Looking briefly at the jq language server
Exploring some more realistic JSON, obtained via the btp CLI
Understanding what data the filter is looking at
Shorthand vs longhand filter expression
Capturing data via the variable operator, and how data is or isn't consumed
Using 'map', passing a filter expression, and how it's similar to JS
Asking for the length of an object gives us the number of properties
Understanding how jq passed data to multiple consuming filters
Producing objects using convenient property shorthand features
Filtering data out with 'select' plus a predicate expression
Sorting with 'sort_by'
Producing a flat list of values for further consumption or file storage, with raw output -r
A brief digression to consider the importance of the array iterator .[] and how it produces multiple values downstream
Looking at what the @tsv and @csv formatters will do for us
Transforming structure with 'group_by' and taking care to understand the new structure produced
Another digression on 'first' being just syntactic sugar for .[0]
Producing a list of data centers providers, with a count
A brief intro to how 'add' can add objects together

Taught by

SAP Developers

Reviews

Start your review of Introduction to jq - Lightweight and Flexible Command-Line JSON Processor

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.