Reputation: 830
I am trying to get the difficulty value out of a JSON structure using jq on the linux command line:
./jq '{result: .difficulty}' status.txt
(The JSON is held in a file called status.txt - shown below) But try as I might I keep getting:
{
"result": null
}
Returned, can someone tell me what I am doing wrong?
{
"result":{
"version":1030000,
"protocolversion":60001,
"walletversion":60000,
"balance":2600.00020000,
"blocks":16042,
"connections":6,
"proxy":"",
"difficulty":28.20775972,
"testnet":false,
"keypoololdest":1382340615,
"keypoolsize":94,
"paytxfee":0.00000000,
"mininput":0.00010000,
"unlocked_until":0,
"errors":""
},
"error":null,
"id":"curltest"
}
Upvotes: 2
Views: 3012
Reputation: 36252
Try to access to result
object and inside it extract the difficulty
value:
./jq '.result.difficulty' status.txt
It yields:
28.20775972
Upvotes: 4