Questions tagged [jsawk]

Jsawk is like awk, but for JSON. You work with an array of JSON objects read from stdin, filter them using JavaScript to produce a results array that is printed to stdout.

Jsawk is like awk, but for JSON. You work with an array of JSON objects read from stdin, filter them using JavaScript to produce a results array that is printed to stdout. You can use this as a filter to manipulate data from a REST JSON web service, for example, in a shell script. Also, you can suppress JSON output and use the built-in printing functions to translate your JSON input to other formats and send that to stdout, to be piped to other processes. You can load JavaScript libraries on the command line to increase your processing power, and other things.

https://github.com/micha/jsawk

9 questions
19
votes
1 answer

How can I put integer as an argument in jq?

I have been trying to use jq to parse a json file returned from the aws cli, but I'm stuck with the problem of referencing an array using the index number. I need to do this because I want to export a text file describing the security groups in a…
zoonoo
  • 485
  • 1
  • 6
  • 13
3
votes
2 answers

Bash Parse JSON Objects jsawk

I´m trying to parse some JSON, which is the output of the Philips Hue API. I found the tool jsawk, but somehow I´m not able to access the data inside the JSON Object. The command: ... | jsawk 'return this.f709f9c0b-on-0.name' works but…
Marcel
  • 43
  • 6
2
votes
1 answer

How to use jsawk to extract value from property of json object with non alpha numeric characters

Example json file content in file /tmp/t [ { "name:first" : "trevor", "last" : "wellington", "from" : "england", "age" : 52, "sports" : [ "rugby", "badmitton", "snooker" ] }, { …
Etienne Low-Décarie
  • 13,063
  • 17
  • 65
  • 87
0
votes
2 answers

How to parse multidimensional JSON array in bash using jsawk?

I have an array like below. I want to parse entire data to my bash array. So i can call the first "JSON addressLineOne" from ${bashaddr[0]}, and…
0
votes
0 answers

how to store jsawk value return to bash variable?

I was installed jsawk, resty, and spidermonkey in my system. and it works perfectly. And now i want to parse the return variable from jsawk , to bash variable. i already try this, and it works. but i want to store the value in variable.…
0
votes
1 answer

How to access special characterized Json key in Bash shell?

I'm using Bash to extract json keys by 'jsawk'. I converted a some.xlsx to some.json by node xlsx . I have some keys like this: "Scheduled Release" "Standard Input Parameters\n(Dev)" The second one contains '\n' because the cell in the .xlsx has 2…
Jeff
  • 1
  • 2
0
votes
1 answer

jsawk won't parse valid JSON

I'm currently developing a bash script that makes a query to a server with curl, and returns a JSON object. I'm trying to parse that object with jsawk. For example, here is some data I'm trying to parse: { "account":{ "quota":20, …
0
votes
1 answer

How to use jsawk if every line is a json object ?

My server generated a json object for each request, so I dump that json object to a access.log file. In this case, each line of access.log is an json object. So How can I use jsawk to parse access.log ? Is there any option to switch on ?
Xing Shi
  • 2,152
  • 3
  • 21
  • 32
-1
votes
2 answers

Need help to parse and print only 'category' values either using jq or jsawk or shell script

Need help to parse and print only category values either using jq or jsawk or shell script. { "fine_grained": { "dog": [ { "category": "cocker spaniel", "mark": 0.9958831668 } ] }, "coarse": [ { …
Joseph
  • 17
  • 2