Jq
reduce - the ur-function
I often think of reduce as the "ur-function", as it's so primitive (in building block terms, not in power or utility terms) and ubiquitous (I'm often disappointed when a new language I come...
read postEasily add an explicit cds.requires.db to your CAP project's package.json
In an experimental CAP project serving data in an in-memory SQLite persistence mechanism, seeded from CSV files (as per the classic starting point in CAP's Grow As You Go approach), I wanted to have...
read postCAP, CDS, CDL, CSN and jq - finding associations
In CAP, relationships between entities can be expressed with associations. In digging into how these are represented internally, I found jq yet again to be invaluable in parsing out info from the...
read postCurating a collection of jq functions
I read a very interesting article DuckDB as the New jq today, plus an equally engaging conversation in the Lobsters thread about it. In the article the author Paul wants to summarise Go repos by...
read postQuick conversion of multiple values using with_entries in jq
This blog post demonstrates how powerful the combination of jq's to_entries and from_entries can be, and show how with_entries is a great extension of that. I pulled some stats from the YouTube Data...
read postA simple jq REPL with tmux, bash, vim and entr
In this quick post I show a simple JSON dataset explorer that gives me a multi-line filter editor. When it comes to exploring and processing JSON data, jq is my goto language. And for exploring, I...
read postSelecting the related endpoints from a GitHub API response using jq's with_entries
I often find myself searching for the related API endpoints for any given chunk of data returned from a call to the GitHub REST API. Let's take an issue as an example, one related to SAP's Open...
read postImproving my interactive jq workflow with ijq, bash and tmux
I'm a big fan of ijq and how it allows me to explore JSON data interactively with jq expressions. With a small script I have improved my workflow by being able to capture the jq expression from ijq...
read postMore on the comma as generator, and streaming with select in jq
In the context of writing a short jq script to turn a JSON representation of an OData entity set into a set of CSV records, I came across something in jq that reminded me of something I'd discovered...
read postRecognising patterns and embracing the stream
I've been listening to discussions on Conor Hoekstra's Array Cast podcast and ADSP: The Podcast and watching some of the content on his YouTube channel, all of which I can highly recommend. While I...
read postLearning from community solutions on Exercism - part 3
In this post I continue to dwell on small details in the jq solutions to Exercism exercises. It follows on roughly from parts 1 and 2. Remote Control Car exercise I was just checking through my...
read postLearning from community solutions on Exercism - part 2
In response to the first part of this series, in relation to the rabbit hole in the Vehicle Purchase exercise, Mattias Wadman kindly shared some variants using generators, which I'll reproduce...
read postLearning from community solutions on Exercism - part 1
There's a relatively new jq track on Exercism, and I've been working through some of the exercises. There are at least a couple of features that appeal to me; one is the ability to easily write and...
read postLearning from exploring a question on jq
In this post I explore different ways of achieving a simple goal in reformulating some JSON, with jq, and explain my thinking as I go. Occasionally I browse the Newest 'jq' questions on Stack Overflow...
read postArray push with autovivification in jq
I wanted to make a note to self about this. I'm using Advent of Code for an opportunity to practise and learn more about jq, and in Day 7: No Space Left On Device I think I need a way of appending...
read postExtracting blog post dates from URLs with jq
I had a JSON array of objects from a list of GitHub repo issues. Each object contained a blog post URL and a title. The URL had the post date embedded in the path, and I wanted to sort them all based...
read postMore Untappd data explorations with jq - my top ranking beer types (part 3)
This is a continuation of part 2 which you should read first. Part 2 finished with an array of category objects, each containing all the checkin ratings for that category, albeit in string form, with...
read postMore Untappd data explorations with jq - my top ranking beer types (part 2)
This is a continuation of part 1 which you should read first. Part 1 finished with a count and list of categories of beer (IPA, Bock, Belgian Tripel, etc), produced from some jq in untappd.jq that...
read postMore Untappd data explorations with jq - my top ranking beer types (part 1)
I've been exploring my Untappd data a bit more since analysing my top brewery countries, this time to see if my average ratings indicated anything about my preferred beer types. Here's what I've done...
read postUntappd data with jq - my top brewery countries
In this short post I explore my Untappd checkin data with jq, because it's a nice data set to practise my limited filtering fu upon, and also to get my blogging flowing again. I'm an Untappd...
read postUnderstanding jq's SQL style operators JOIN and INDEX
In this post I explore a couple of new (to me) operators in jq's arsenal: JOIN and INDEX, based on an answer to a question that I came across on Stack Overflow. The answer was in response to a...
read postSumming and grouping values with jq
Here's yet another note-to-self on using jq, this time to transform a flat list of order totals and dates into a summary of total order values by year. In doing some research for an upcoming live...
read postReshaping data values using jq's with_entries
Receipt of a JSON file containing valid tags for tutorial metadata gave me the perfect opportunity to explore it and learn a bit more jq in the process. For each of our tutorials in SAP's Tutorial...
read postMultiple level filters in jq
Here's another note-to-self on using jq to shape JSON representations of OData to match what's returned using system query options. Thsi time it's all filtering at two levels. In the Back to basics:...
read postProducts by supplier in OData and jq
This is more of a note-to-self. I'm enjoying comparing resource requests in OData with the equivalent shaping with jq. Here's a simple example. With the Northwind OData v4 service there are Products...
read postExploring JSON with interactive jq
I often use ijq, or "interactive jq", to explore JSON, and also to improve my jq fu, because it gives me immediate visual feedback. Here's an example. There's a wrapper around jq called ijq...
read postJSON object values into CSV with jq
I wanted to grab a CSV version of a JSON representation of an entityset in the Northwind OData service. Here's how I converted the JSON structure into CSV with jq, and along the way, I talk about...
read postExploring GitHub repo name distribution with jq
I wanted a brief rundown of the name prefixes for repositories in the SAP-samples organisation on GitHub. With the gh CLI it was easy to grab the names, and gave me the opportunity to practise a bit...
read postConverting strings to objects with jq
In preparing some data for another upcoming blog post (now published: Exploring GitHub repo name distribution with jq), I needed to convert a list of fully qualified GitHub repository names into a...
read postSome thoughts on jq and statelessness
I came across a great article via lobsters recently: Introducing zq: an Easier (and Faster) Alternative to jq. I posted some brief thoughts on it over on the lobsters thread, and in the spirit of...
read postUnderstanding jq's reduce function
It took me a bit of time to get my head around jq's reduce function. In this post I show how it relates to the equivalent function in JavaScript, which helped me understand it better, and might help...
read postExercism and jq
I wanted to see how a jq track might work in Exercism. Here's what I tried out this morning. Exercism is a great resource for learning and practising languages. I've dabbled in a couple of tracks and...
read postEmbracing jq and JSON
Finding objects in a complex JSON structure isn't as scary as I thought with jq. My friend and colleague Rui was asking today about finding directory information for a given global account on SAP's...
read postProducing JSON with jq for appending issue titles
I learned how to use jq to produce JSON, while writing a script to enhance my Thinking Aloud journal entry titles. In my Thinking Aloud journal, the entries are issues in a GitHub repository. To...
read postMass deletion of GitHub Actions workflow runs
Implementing a simple cleanup script for workflow runs, using gh, jq, fzf and the GitHub API Yesterday, while thinking aloud, I was wondering how best to mass-delete logs from GitHub Actions workflow...
read post