Skip to content

Instantly share code, notes, and snippets.

View lavellotron's full-sized avatar

Patrick Greenwood lavellotron

View GitHub Profile
@OlegGorj
OlegGorj / loop through json.md
Created September 22, 2019 19:52
looping through JSON array in shell script

Assume we have following json:

{
  "path": {
    "components": [],
    "name": "",
    "toString": ""
  },
  "revision": "master",
@cekstam
cekstam / gist:a7758b8f315835d479f379715eebd0c3
Last active December 27, 2021 14:15
create valid JSON from git log using python and ast.literal_string
git log -n 10\
--pretty=format:'{"commit": "%H", "author": "%aN <%aE>", "date": "%ai", "message": """%B""", "notes": """%N""" },' \
$@ | awk 'BEGIN { print("[") } { print($0) } END { print("]") }' | python -u -c \
'import ast,json,sys; print(json.dumps(ast.literal_eval(sys.stdin.read())))'
@olih
olih / jq-cheetsheet.md
Last active July 16, 2024 23:02
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq