ValueError: No JSON object could be decoded while using WGET to filter a simple api request from CLI in linux

ValueError: No JSON object could be decoded while using WGET to filter a simple api request from CLI in linux

基本上我不能在简单的 linux 机器上使用 curl,但我有 WGET。 我有这个 json

{
 "inStandby": "false", 
 "currservice_begin": "10:38", 
 "currservice_begin_timestamp": 34332, 
 "currservice_end_timestamp": 15759723423500, 
 "muted": false, 
 "isRecording": "false", 
 "currservice_station": "02 2 HD", 
 "currservice_serviceref": "1:0:19:4B0:1:1:334:0:0:0:", 
 "currservice_description": "Mv i v", 
 "volume": 50, 
 "currservice_fulldescription": "asdfasd", 
 "currservice_filename": "", 
 "transcoding": true, 
 "currservice_end": "11:25", 
 "currservice_id": 36172
}

我试图仅将 "currservice_serviceref" 值打印到文件中。我试过了

wget localhost/api/statusinfo | python -c 'import json,sys;data=json.load(sys.stdin);print data["currservice_serviceref"]'

我通过添加 -qO-(打印到标准输出)来解决,因为我认为 python 试图从标准输入(sys.stdin)读取。