Open low-decarie opened 9 years ago
StackOverflow question
Example json file content in file /tmp/t
/tmp/t
[ { "name:first" : "trevor", "last" : "wellington", "from" : "england", "age" : 52, "sports" : [ "rugby", "badmitton", "snooker" ] }, { "name:first" : "yoni", "last" : "halevi", "from" : "israel", "age" : 26, "sports" : [ "soccer", "windsurfing" ] }, { "name:first" : "cory", "last" : "parker", "from" : "united states", "age" : 31, "sports" : [ "windsurfing", "baseball", "extreeeeme kayaking" ] } ]
This works fine cat /tmp/t | jsawk -n 'out(this.last)'
cat /tmp/t | jsawk -n 'out(this.last)'
But this does not cat test.json | jsawk -n 'out(this.name:first)'
cat test.json | jsawk -n 'out(this.name:first)'
Umm, this has to do with the ":" in the param name. If you replace with an underscore it works. Though, not what you want of course. But that's why it's currently failing in the second test.
StackOverflow question
Example json file content in file
/tmp/t
This works fine
cat /tmp/t | jsawk -n 'out(this.last)'
But this does not
cat test.json | jsawk -n 'out(this.name:first)'