基本上,我不能在简单的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-(打印到stdout来解决),因为我认为python试图从stdin(sys.stdin)读取。