Wikipedia:Reference desk/Archives/Computing/2016 September 22
Appearance
Computing desk | ||
---|---|---|
< September 21 | << Aug | September | Oct >> | September 23 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
September 22
[edit]Xidel help
[edit]Using xidel how would you extract only the "no" data from this json feed? The feed contains 150 items each with "no" and "last_modified". I want only the "no" data returned for all 150 items,
For example
{"no":40489590,"last_modified":1421804809},{"no":89921534,"last_modified":1474576329},{"no":89924252,"last_modified":1474576328}
etc would become;
40489590 89921534 89924252
etc. I tried reading the manual and readme text but I just can't work out the syntax and I have no experience with json. Thanks for your help! 179.197.26.37 (talk) 20:40, 22 September 2016 (UTC) (Copied from WT:RD edit request. -- ToE 22:49, 22 September 2016 (UTC))
- Have you tried:
xidel http://a.4cdn.org/pol/threads.json -e '$json/threads/no'
- For syntax utilizing other JSON notation, see #11 under http://www.videlibri.de/xidel.html#examples -- ToE 12:32, 23 September 2016 (UTC)
- Following myself up, the XPath-like notation above (-e '$json/threads/no') seems to work on my system and do just what you want, but the other two notations -- JSONiq (-e '$json("threads")("no")') and dot (-e '($json).threads.no') -- yield no output. I don't know anything more about this as I just installed xidel to see if I could help answer your question. I may be missing something simple. -- ToE 17:11, 23 September 2016 (UTC)