Jid – Drill down JSON data incrementally
github.com
Jid – Drill down JSON data incrementally
1–10 of 55 posts
Re: Jid – Drill down JSON data incrementally
#2Re: Jid – Drill down JSON data incrementally
#3Re: Jid – Drill down JSON data incrementally
#4 require 'json'
require 'open-uri'
data = JSON.load(open("https://api.github.com/users/Dorian"))
data.keys
data.first
data["public_repos"]
etc.Re: Jid – Drill down JSON data incrementally
#5Re: Jid – Drill down JSON data incrementally
#6For example consider this.
echo '{"users":[{"name":"s1","id":1},{"name":"s2","id":2}]}'|jid
I can query users[0].id or users[1].id. How can I get all the ids? I tried users[*].id which didn’t work.In Clojure I use specter [1] for this which is able to handle wildcards using ALL.
Re: Jid – Drill down JSON data incrementally
#7How can I use wildcards in queries? For example consider this. echo '{"users":[{"name":"s1","id":1},{"name":"s2","id":2}]}'|jid I can query users[0].id or users[1].id. How can I get all the ids? I tried users[*].id which didn’t work. In Clojure I use specter [1] for this which is able to handle wildcards using ALL. [1] https://github.com/nathanmarz/specter
E.g. users[].id
Re: Jid – Drill down JSON data incrementally
#8The JSON crowd is re-inventing LISP. Originally, JSON was a subset of what you could pass to "eval()". Yesterday, state machine programming in JSON. Today, an inspector.
Many people like LISP.
Re: Jid – Drill down JSON data incrementally
#9Re: Jid – Drill down JSON data incrementally
#10I 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.
I used to do that in Python, but it is a pain. jq is great for these things, and jid seems to be also.