Jshon: A command line program to parse, read and create JSON
1–10 of 21 posts
Re: Jshon: A command line program to parse, read and create JSON
#2 $ type json
json is aliased to `python -m json.tool'
$ curl -s twitter.com/users/BarackObama.json|json|grep '"url"'
"url": "http://www.barackobama.com",Re: Jshon: A command line program to parse, read and create JSON
#3Re: Jshon: A command line program to parse, read and create JSON
#4Using JSON to extend command line processing looks to me like it is a nice step forward. Things like Microsoft's PowerShell are perhaps conceptually more elegant (where you pass real live objects about) but the practical reality always seems very fussy and tied to a particular programming platform. Other approaches (e.g. passing XML between Unix-style command line programs) isn't very appealing due to the general ugliness and verbosity of most XML.
Re: Jshon: A command line program to parse, read and create JSON
#5References for XML: http://www.lbreyer.com/unix_xml-1.html http://www.ofb.net/~egnor/xml2/ http://gnosis.cx/publish/programming/xml_matters_17.html
Re: Jshon: A command line program to parse, read and create JSON
#6 echo "{ 'a': {'b': {'c": 0 } } }" | json-tool "a.b.c" # echos 0
Maybe your tool does that but I missed itRe: Jshon: A command line program to parse, read and create JSON
#7Re: Jshon: A command line program to parse, read and create JSON
#8Great tool, was thinking about writing something like that myself. I especially wanted a tool that would print the value of a specific key to STDOUT with a syntax like echo "{ 'a': {'b': {'c": 0 } } }" | json-tool "a.b.c" # echos 0 Maybe your tool does that but I missed it
You can do similar with -e a -e b -e c. Or just make your own wrapper with
jshon $(echo ".a.b.c" | sed 's/./ -e/g')
Re: Jshon: A command line program to parse, read and create JSON
#9Jsawk seems more intuitive, as you get to write JavaScript instead of combining command-line flags: https://github.com/micha/jsawk
Re: Jshon: A command line program to parse, read and create JSON
#10Senator, I know awk, and that is not an alarming bit of awk.