42 ms·
I personally like digging in a ruby console, e.g.: require 'json' require 'open-uri' data = JSON.load(open("https://api.github.com/users/Dorian"))
by dorianm 10y ago
I personally like digging in a ruby console, e.g.:
require 'json'
require 'open-uri'
data = JSON.load(open("https://api.github.com/users/Dorian"))
data.keys
data.first
data["public_repos"]
etc.
- fiatjaf 10y agoYou personally like to suffer. I used to do that in Python, but it is a pain. jq is great for these things, and jid seems to be also.
- wellsjohnston 10y agoI made a gui for this https://github.com/wellsjo/JSON-Splora https://github.com/wellsjo/JSON-Splora
- dorianm 10y agoHow would you do a `data.keys.sort` with jq? Here I don't have to learn a new programming language or hack around with UNIX pipes ;)
- lumpypua 10y ago`keys|sort` in jq.
- dorianm 10y agoNice! Thanks
- hyperpallium 10y agojq has sort and sort_by(exp). Its | is a jq operator, not a unix pipe. It's true it's a new lang, and although simple, I often have to look things up. It might be nice to have a jq REPL, so needn't quote, and easier to keep state around.
- voltagex_ 10y agoI find jq syntax tricky, and it's difficult to work out what I need to get to specific elements. I guess I'm more used to things like XPath. Seconding the request for a REPL