Jq

From Leaky
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