Transforming, sorting, and grouping JSON documents in the command-line - jq tutorial
In this video, I show you how to use the jq command-line to parse and transform a JSON response to the desired format. I use openlibrary.org Search API to get a complex JSON document (~3600 lines) using curl command for further parsing using jq. In the first step, we extract three fields for each document (title, author, publishing year) and then we continue transforming the JSON - we sort it, we limit the number of elements, and last but not least, we group elements by the author name.
This video is the first part of the new series where we are going to learn how to use jq to solve some practical and real-life problems. I hope you enjoy it! 😀
⏱️ Timestamps:
00:00 | Intro
00:30 | What we are going to learn?
01:10 | Calling openlibrary.org Search API with curl
02:23 | Using object/value iterator
02:51 | Transforming input JSON to the desired format
03:43 | Filtering null values with the select function
04:23 | Sorting an array by the specific field using sort_by(expr)
05:46 | Limiting the number of elements using limit(n;expr)
06:48 | Grouping elements by the specific field using group_by(expr)
09:22 | End screen
===========================================
➡️ jq project website
- https://stedolan.github.io/jq/
➡️ "Parsing JSON in command-line with jq: basic filters and functions (part 1)" blog post
- https://e.printstacktrace.blog/parsing-json-in-command-line-with-jq-basic-filters-and-functions-part-1/
☕️ BUY ME A COFFEE (thanks in advance! 😀)
- https://e.printstacktrace.blog/buy-me-a-coffee
📧 JOIN MY NEWSLETTER
- https://e.printstacktrace.blog/newsletter
🔥 MORE JQ TUTORIAL VIDEOS & RESOURCES:
- jq tutorial playlist - https://www.youtube.com/playlist?list=PLKaiHc24qCTSOGkkEpeIMupEmnInqHbbV
- jq cookbook blog posts - https://e.printstacktrace.blog/jq-cookbook
📷 CAMERA GEAR I USE:
- My camera - https://e.printstacktrace.blog/gear/camera?utm_source=jq02
- 25mm f1.7 lens - https://e.printstacktrace.blog/gear/lens?utm_source=jq02
- Microphone - https://e.printstacktrace.blog/gear/microphone?utm_source=jq02
- LED lights - https://e.printstacktrace.blog/gear/light?utm_source=jq02
- Check my full kit - https://kit.co/wololock/my-youtube-studio-gear
🛠️ TOOLS & SERVICES I USE TO:
- design YouTube thumbnails (Canva) - https://e.printstacktrace.blog/canva?utm_source=jq02
- improve my grammar skills (Grammarly) - https://e.printstacktrace.blog/grammarly?utm_source=jq02
- develop mailing list (ConvertKit) - https://e.printstacktrace.blog/convertkit?utm_source=jq02
- listen to audiobooks (Audible, 30 days free trial) - https://e.printstacktrace.blog/audible?utm_source=jq02
- read Kindle ebooks (Kindle Unlimited) - https://e.printstacktrace.blog/kindleunlimited?utm_source=jq02
- secure network connection with VPN (NordVPN) - https://e.printstacktrace.blog/nordvpn?utm_source=jq02
- improve SEO on YouTube (VidIQ) - https://e.printstacktrace.blog/vidiq?utm_source=jq02
- host WordPress websites (Bluehost) - https://e.printstacktrace.blog/bluehost?utm_source=jq02
❤️ SUPPORT MY WORK
- Github Sponsors - https://github.com/sponsors/wololock
- Open Collective - https://opencollective.com/eprintstacktrace
- Other options - https://e.printstacktrace.blog/support-me/?utm_source=jq02
👋 STAY IN TOUCH:
- Blog - https://e.printstacktrace.blog?utm_source=jq02
- Twitter - https://twitter.com/wololock
- LinkedIn - https://www.linkedin.com/in/szymon-st%C4%99pniak-9a0b1630
- Github - https://github.com/wololock
✉️ CONTACT:
For all subscribers, please use this email: hello@printstacktrace.blog
For business inquires only, please use this email: collabs@printstacktrace.blog
DISCLAIMER: Some of the links above are affiliate links. If you decide to click that link and subsequently make a purchase, I will get a small percentage from your purchase. Using the affiliate link does not affect the final price of the product. The commission I earn comes at no additional cost to you. Thank you for supporting my channel so I can continue to provide you with free content on a regular basis!
And remember - it's all about helping YOU to become a better software developer! Thanks!
#eprintstacktrace #szymonstepniak
Видео Transforming, sorting, and grouping JSON documents in the command-line - jq tutorial канала Szymon Stepniak
This video is the first part of the new series where we are going to learn how to use jq to solve some practical and real-life problems. I hope you enjoy it! 😀
⏱️ Timestamps:
00:00 | Intro
00:30 | What we are going to learn?
01:10 | Calling openlibrary.org Search API with curl
02:23 | Using object/value iterator
02:51 | Transforming input JSON to the desired format
03:43 | Filtering null values with the select function
04:23 | Sorting an array by the specific field using sort_by(expr)
05:46 | Limiting the number of elements using limit(n;expr)
06:48 | Grouping elements by the specific field using group_by(expr)
09:22 | End screen
===========================================
➡️ jq project website
- https://stedolan.github.io/jq/
➡️ "Parsing JSON in command-line with jq: basic filters and functions (part 1)" blog post
- https://e.printstacktrace.blog/parsing-json-in-command-line-with-jq-basic-filters-and-functions-part-1/
☕️ BUY ME A COFFEE (thanks in advance! 😀)
- https://e.printstacktrace.blog/buy-me-a-coffee
📧 JOIN MY NEWSLETTER
- https://e.printstacktrace.blog/newsletter
🔥 MORE JQ TUTORIAL VIDEOS & RESOURCES:
- jq tutorial playlist - https://www.youtube.com/playlist?list=PLKaiHc24qCTSOGkkEpeIMupEmnInqHbbV
- jq cookbook blog posts - https://e.printstacktrace.blog/jq-cookbook
📷 CAMERA GEAR I USE:
- My camera - https://e.printstacktrace.blog/gear/camera?utm_source=jq02
- 25mm f1.7 lens - https://e.printstacktrace.blog/gear/lens?utm_source=jq02
- Microphone - https://e.printstacktrace.blog/gear/microphone?utm_source=jq02
- LED lights - https://e.printstacktrace.blog/gear/light?utm_source=jq02
- Check my full kit - https://kit.co/wololock/my-youtube-studio-gear
🛠️ TOOLS & SERVICES I USE TO:
- design YouTube thumbnails (Canva) - https://e.printstacktrace.blog/canva?utm_source=jq02
- improve my grammar skills (Grammarly) - https://e.printstacktrace.blog/grammarly?utm_source=jq02
- develop mailing list (ConvertKit) - https://e.printstacktrace.blog/convertkit?utm_source=jq02
- listen to audiobooks (Audible, 30 days free trial) - https://e.printstacktrace.blog/audible?utm_source=jq02
- read Kindle ebooks (Kindle Unlimited) - https://e.printstacktrace.blog/kindleunlimited?utm_source=jq02
- secure network connection with VPN (NordVPN) - https://e.printstacktrace.blog/nordvpn?utm_source=jq02
- improve SEO on YouTube (VidIQ) - https://e.printstacktrace.blog/vidiq?utm_source=jq02
- host WordPress websites (Bluehost) - https://e.printstacktrace.blog/bluehost?utm_source=jq02
❤️ SUPPORT MY WORK
- Github Sponsors - https://github.com/sponsors/wololock
- Open Collective - https://opencollective.com/eprintstacktrace
- Other options - https://e.printstacktrace.blog/support-me/?utm_source=jq02
👋 STAY IN TOUCH:
- Blog - https://e.printstacktrace.blog?utm_source=jq02
- Twitter - https://twitter.com/wololock
- LinkedIn - https://www.linkedin.com/in/szymon-st%C4%99pniak-9a0b1630
- Github - https://github.com/wololock
✉️ CONTACT:
For all subscribers, please use this email: hello@printstacktrace.blog
For business inquires only, please use this email: collabs@printstacktrace.blog
DISCLAIMER: Some of the links above are affiliate links. If you decide to click that link and subsequently make a purchase, I will get a small percentage from your purchase. Using the affiliate link does not affect the final price of the product. The commission I earn comes at no additional cost to you. Thank you for supporting my channel so I can continue to provide you with free content on a regular basis!
And remember - it's all about helping YOU to become a better software developer! Thanks!
#eprintstacktrace #szymonstepniak
Видео Transforming, sorting, and grouping JSON documents in the command-line - jq tutorial канала Szymon Stepniak
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![Merging JSON documents in the command-line - jq tutorial](https://i.ytimg.com/vi/uIKvYgix-L4/default.jpg)
![Learn JSON in 10 Minutes](https://i.ytimg.com/vi/iiADhChRriM/default.jpg)
![Processing JSON in the command-line made easy - jq tutorial (first steps)](https://i.ytimg.com/vi/FSn_38gDvzM/default.jpg)
![Building command-line app with Java 11, Micronaut, Picocli, and GraalVM](https://i.ytimg.com/vi/Xdcg4Drg1hc/default.jpg)
![1.4: JSON - Working with Data and APIs in JavaScript](https://i.ytimg.com/vi/uxf0--uiX0I/default.jpg)
![7 Database Paradigms](https://i.ytimg.com/vi/W2Z7fbCLSTw/default.jpg)
![Linux Shell Parsing JSON with jq](https://i.ytimg.com/vi/NOlRKZF2JRo/default.jpg)
![How to use FZF, curl & jq together](https://i.ytimg.com/vi/KswdZlpzm4c/default.jpg)
![How to get O'Reilly Learning Platform with a significant discount? Join ACM.org!](https://i.ytimg.com/vi/OQr2Rv5C-P0/default.jpg)
![How To Build Sortable Drag & Drop With Vanilla Javascript](https://i.ytimg.com/vi/jfYWwQrtzzY/default.jpg)
![Groovy Tutorial: Learn Groovy DSL by Example in 20 minutes](https://i.ytimg.com/vi/i9pNYW1Pg9A/default.jpg)
![David Hand - "Non-trivial jq"](https://i.ytimg.com/vi/MvI6Z85EgVo/default.jpg)
![Pipeline-Scripts - Create a parameterized Jenkins job using Pipeline Scripts](https://i.ytimg.com/vi/VSBVlPfK7Ww/default.jpg)
![15 Python Projects in Under 15 Minutes (Code Included)](https://i.ytimg.com/vi/OXi4T58PwdM/default.jpg)
![Groovy Tutorial: Groovy Closures Explained by Example](https://i.ytimg.com/vi/fdpKCuJKbMg/default.jpg)
![Using JQ to Make Magic with JSON Files](https://i.ytimg.com/vi/XE1CXR9iINQ/default.jpg)
![JSON: Like a Boss](https://i.ytimg.com/vi/_ZTibHotSew/default.jpg)
![JQ tutorial with example code - follow along](https://i.ytimg.com/vi/xaaGhvI0ct8/default.jpg)
![Real time policy enforcement with Cloud Custodian](https://i.ytimg.com/vi/FZgAoZgAz8c/default.jpg)
![Implementing OAuth 2.0 in a Java command-line app using Micronaut, Picocli, and GraalVM](https://i.ytimg.com/vi/js5H9UbmmMY/default.jpg)