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.
Try
<test.json jsawk 'return this.account.quota'
I removed your useless use of cat
.