Hello everyone and welcome to our second edition of the Confluent DevX Newsletter! If you happen to live in participating states in the U.S., we hope daylight savings wasn’t too rough. Wherever you live, we hope that your Pi Day was filled with mathematical joy. We’ve got all sorts of goodies this week ranging from Apache Kafka® migration tips to animals crocheted with patterns devised by ChatGPT. So let’s dive in…
You might have heard of the jq utility to transform JSON data, but what about XML? Enter python-yq. Installing it allows you to use xq, which formats XML to JSON like so:
curl --show-error --silent \
https://tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml \ | xq -c '.stations.station[] + {lastUpdate: .stations."@lastUpdate"}'
Result:
{"id":"850","name":"Brandon Street, Walworth","terminalName":"300060","lat":"51.489102","long":"-0.0915489","installed":"true","locked":"false","installDate":null,"removalDate":null,"temporary":"false","nbBikes":"11","nbStandardBikes":"10","nbEBikes":"1","nbEmptyDocks":"11","nbDocks":"22","lastUpdate":"1677702601270"}
Here you see that bicycle rental data, expressed as XML, is transformed into JSON objects by the xq utility. Neat!
Kafka Summit London is happening soon, May 16-17! Register at the conference home page.
We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.