Closed ghost closed 2 years ago
Why jq '.servers'
?
The most outer key of json is http-flv
. So I thought 'jq .http-flv.servers'
was OK, but I got a parse error, because in jq, -
is a key word.
The following is correct:
jq '.["http-flv"].servers'
The following is the result I have tested:
curl http://localhost:8080/stat | jq '.["http-flv"].servers'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 529 100 529 0 0 103k 0 --:--:-- --:--:-- --:--:-- 129k
[
{
"port": 1935,
"server_index": 0,
"applications": [
{
"name": "myapp",
"live": {
"streams": [],
"nclients": 0
},
"recorders": {
"count": 0,
"lists": []
}
}
]
},
{
"port": 1975,
"server_index": 1,
"applications": [
{
"name": "mytest",
"live": {
"streams": [],
"nclients": 0
},
"recorders": {
"count": 0,
"lists": []
}
}
]
}
]
Thanks for this, it's better but why this does not work ? i have one application name called "flv".
curl -s http://localhost/stat | jq '.["http-flv"].servers[] | select(. applications.name == "flv")'
error: jq: error (at
Le sam. 4 déc. 2021 à 15:42, XingY Wang @.***> a écrit :
Why jq '.servers'? The most outer key of json is http-flv. So I thought jq .http-flv.servers was OK, but I got a parse error, because in jq, - is a key word.
The following is correct:
jq '.["http-flv"].servers'
The following is the result I have tested:
curl http://localhost:8080/stat | jq '.["http-flv"].servers' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 529 100 529 0 0 103k 0 --:--:-- --:--:-- --:--:-- 129k [ { "port": 1935, "server_index": 0, "applications": [ { "name": "myapp", "live": { "streams": [], "nclients": 0 }, "recorders": { "count": 0, "lists": [] } } ] }, { "port": 1975, "server_index": 1, "applications": [ { "name": "mytest", "live": { "streams": [], "nclients": 0 }, "recorders": { "count": 0, "lists": [] } } ] } ]
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/winshining/nginx-http-flv-module/issues/216#issuecomment-986038648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7MP54XYTHUANTFYXJ7VADUPISGVANCNFSM5JLNP6CQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Hi, I want to use json stat request wut but without success, some problems with the json tree
this work : curl -s http://localhost/stat | jq .... json data ....
But this curl -s http://localhost/stat | jq '.servers[]' gives an error.
What parameters in the request do i have to pass to get applications list for example ?
Thanks