Not because it’s elegant, fun or easy. JK! While APIs are JSON native, people aren’t. • Pretty Print • Validate JSON • Parse JSON • Search JSON • Build JSON
It’s so critical, we embedded it into our golang CLI so we didn’t have to install it everywhere. If you cp & suffix “drpcli” with “jq” then it becomes a JQ parser! How much does RackN JQ?
as Code with API-driven Provisioning All our API models and events are JSON All our states are JSON All our IaC templates are JSON (ok, we source them in YAML because readability) What does RackN do?
cat all.json | jq ‘.[] | select(.Name==”test1”)’ Can use lots of logic! Like has, in, >, etc but, be careful of unexpected output! cat all.json | \ jq '.[] | select(.Name | startswith("test"))'
maps (arrays) this is set operations…. be careful cat all.json | \ jq 'map(.Name | startswith("test"))' not what you think! cat all.json | \ jq 'map(select(.Name | startswith("test")))'