Jq

From Leaky
Revision as of 11:31, 12 October 2020 by Leaky (talk | contribs) (Created page with "A utility for parsing and processing JSON data. Download from https://stedolan.github.io/jq/ == Recipes == Download https://api.guildwars2.com/v1/maps.json and extract the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A utility for parsing and processing JSON data.

Download from https://stedolan.github.io/jq/

Recipes

Download https://api.guildwars2.com/v1/maps.json and extract the name/id of all public maps

jq '.maps | to_entries[] | select (.value.type == "Public") | {name:.value.map_name, id:.key}' maps.json

to_entries converts a hash into an array of objects consisting of { key:..., value:... }

select() filters the objects