Skip to content

Instantly share code, notes, and snippets.

@d3banjan
Created March 12, 2022 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d3banjan/b292d5f6ba20991441e88f66a5d5a36c to your computer and use it in GitHub Desktop.
Save d3banjan/b292d5f6ba20991441e88f66a5d5a36c to your computer and use it in GitHub Desktop.
jq-recipes
curl -L "https://raw.githubusercontent.com/noSenseOfDangerous/PythonDesignPattern/master/factoryPattern_01/data/donut.json" -o donut.json
# % Total % Received % Xferd Average Speed Time Time Time Current
# Dload Upload Total Spent Left Speed
# 100 2895 100 2895 0 0 14532 0 --:--:-- --:--:-- --:--:-- 14547
ls -lh .
# total 4,0K
# -rw-r--r-- 1 debanjan debanjan 2,9K 12. Mär 15:02 donut.json
wc -l *
# 129 donut.json
jq '.' donut.json
# [
# {
# "id": "0001",
# "type": "donut",
# "name": "Cake",
# "ppu": 0.55,
# "batters": {
# "batter": [
# {
# "id": "1001",
# "type": "Regular"
# },
# {
# "id": "1002",
# "type": "Chocolate"
# },
# {
# "id": "1003",
# "type": "Blueberry"
# },
# {
# "id": "1004",
# "type": "Devil's Food"
# }
# ]
# },
# "topping": [
# {
# "id": "5001",
# "type": "None"
# },
# {
# "id": "5002",
# "type": "Glazed"
# },
# {
# "id": "5005",
# "type": "Sugar"
# },
# {
# "id": "5007",
# "type": "Powdered Sugar"
# },
# {
# "id": "5006",
# "type": "Chocolate with Sprinkles"
# },
# {
# "id": "5003",
# "type": "Chocolate"
# },
# {
# "id": "5004",
# "type": "Maple"
# }
# ]
# },
# {
# "id": "0002",
# "type": "donut",
# "name": "Raised",
# "ppu": 0.55,
# "batters": {
# "batter": [
# {
# "id": "1001",
# "type": "Regular"
# }
# ]
# },
# "topping": [
# {
# "id": "5001",
# "type": "None"
# },
# {
# "id": "5002",
# "type": "Glazed"
# },
# {
# "id": "5005",
# "type": "Sugar"
# },
# {
# "id": "5003",
# "type": "Chocolate"
# },
# {
# "id": "5004",
# "type": "Maple"
# }
# ]
# },
# {
# "id": "0003",
# "type": "donut",
# "name": "Old Fashioned",
# "ppu": 0.55,
# "batters": {
# "batter": [
# {
# "id": "1001",
# "type": "Regular"
# },
# {
# "id": "1002",
# "type": "Chocolate"
# }
# ]
# },
# "topping": [
# {
# "id": "5001",
# "type": "None"
# },
# {
# "id": "5002",
# "type": "Glazed"
# },
# {
# "id": "5003",
# "type": "Chocolate"
# },
# {
# "id": "5004",
# "type": "Maple"
# }
# ]
# }
# ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment