I have an IP camera with armv5tejl architecture. There I have busybox. I have to be able to parse JSON responses from curl. The problem is that I don't have programs like:
jq, jshon, jsawk...
It is hard to instal them for this architecture. I have to find some shell script which can parse JSON object and JSON array.

If it is possible to find this script, please, show me that script

  • what about perl? – Jeff Schaller Jul 27 '16 at 17:28
  • Don't have neither perl nor python. I have to find some solution with awk, sed, grep and so on.. – Alexandr Jul 27 '16 at 17:30
  • 2
    jq should not be hard to compile from source, it only needs bison and flex – grochmal Jul 27 '16 at 19:32

You have ash or bash so you can use json.sh. You have awk so you can use json.awk.

  • Yes. Thank you for help. I have found json.awk just several minutes ago) – Alexandr Jul 27 '16 at 20:16
  • json.sh also works with ash – Alexandr Jul 27 '16 at 20:34

As grochmal said. There is jq which is pretty good but I couldn't compile it.
Also we can just use JSON.awk to parse json (is not very convenient but works). Example:

echo -e jsonFile | awk -f JSON.awk

To get necessary keys and values we can grep output. Example (parse json response with google drive folders to find all ids of folders):

echo -e jsonResponse | awk -f JSON.awk | egrep '\["items",[0-9]+,"id"\]' 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.