Deutsch | English
This blog does not contain official statements of CERT.at, only personal opinions of the individual contributors.

Transforming JSON to CSV

2014/06/14

CERTs are all about processing information security notifications. Most of the time, these arrive in the form of CSV files. However, occasionally we do get some JSON data. While CSV is line oriented, JSON allows for more complex structures (arrays, objects, objects in objects, etc.)

So how to you easily transform complex JSON structures to CSV? Most programmers would look at the specific JSON format and start writing a converter. However, there is a smarter way: JQ!

JQ is a JSON filter / transform mechanism.

To quote JQ's homepage: "A jq program is a 'filter': it takes an input, and produces an output. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks."

In short: JQ is like awk and xargs for JSON. Mightly practical stuff!

Author: L. Aaron Kaplan

Email: reports@cert.at
Phone: +43 1 5056416 78
more ...
Mac OS X tip: how to protect your mail client
2018/05/14 | Based on ...
Successful MISP workshop
2018/02/20 | Last week ...
more ...
Last Change: 2014/6/14 - 20:23:12
Haftungsausschluss / Data Protection & Privacy Policy