Difference between revisions of "Jq"

From Leaky
Jump to: navigation, search
(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...")
 
(No difference)

Latest revision as of 11:31, 12 October 2020

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