0

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,
        "email":"test@example.com",
        "uuid":"12ae7a0cbd",
        "email_verified":true
    }
}

In terminal I'm running cat test.json | jsawk -q 'account.quota'.

Assume test.json is the above object. Every time I run that command, I always get the following error: jsawk: js error: ReferenceError: account is not defined, even though account is very clearly defined.

4ae1e1
  • 7,228
  • 8
  • 44
  • 77
  • From the docs you linked https://github.com/micha/jsawk, looks like you should be using 'this.account.quota' or maybe 'return this.account.quota' – Hypaethral Apr 10 '15 at 20:29

1 Answers1

1

Try

<test.json jsawk 'return this.account.quota'

I removed your useless use of cat.

4ae1e1
  • 7,228
  • 8
  • 44
  • 77