Preface:
(For the following examples I replaced my personal access token with ABCDEF)
Doing a curl request against the Steam API works of course. Note that I need to quote the URL because of characters like ?, & and \ that would otherwise be (mis-)interpreted by the shell:
curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120"
Result:
{"response":{"servers":[{"addr":"78.34.130.134:27016","gameport":27015,"steamid":"90282946280681494","name":"Not Barry's either...","appid":42120,"gamedir":"leadandgoldinternalbeta","version":"1.0.0.0","product":"POWDERKEG","region":255,"players":0,"max_players":10,"bots":0,"map":"DEADWATER RANCH","secure":false,"dedicated":true,"os":"w"},{"addr":"89.168.103.250:27016","gameport":27015,"steamid":"90281696798215199","name":"There is a new server in town.","appid":42120,"gamedir":"leadandgoldinternalbeta","version":"1.0.0.0","product":"CONQUEST","region":255,"players":0,"max_players":10,"bots":0,"map":"DEVIL´S PIT","secure":false,"dedicated":true,"os":"w"}]}}
Piping this through jq also works as expected:
curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" | jq ".response.servers[].name"
Result:
"Not Barry's either..."
"There is a new server in town."
Using this command chain as an argument to another command fails of course:
echo curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" | jq ".response.servers[]"
Result:
jq: parse error: Invalid numeric literal at line 1, column 5
(Explanation: echo returns the curl -s "https://api.steam[..] string which then gets piped into jq which then throws an error because that string is of course not valid JSON.)
If echo is supposed to process the whole rest of the line as argument, I need to escape the pipe (|) symbol, which on Windows is done with a ^:
echo curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" ^| jq ".response.servers[]"
Result:
curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" | jq ".response.servers[]"
(This works exactly as I would expect now.)
Issue:
Now, replacing the echo with watch, I would expect that watch also takes the whole rest of the line as its argument and runs it periodically:
watch curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" ^| jq ".response.servers[]"
Result:
[2026-03-21 13:37:00] Execute [curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\\42120" | jq .response.servers[]] every 5s
{"response":{"servers":[{"addr":"78.34.130.134:27016","gameport":27015,"steamid":"90282946280681494","name":"Not Barry's either...","appid":42120,"gamedir":"leadandgoldinternalbeta","version":"1.0.0.0","product":"POWDERKEG","region":255,"players":0,"max_players":10,"bots":0,"map":"PROSPECTOR´S PEAK","secure":false,"dedicated":true,"os":"w"},{"addr":"89.168.103.250:27016","gameport":27015,"steamid":"90281696798215199","name":"There is a new server in town.","appid":42120,"gamedir":"leadandgoldinternalbeta","version":"1.0.0.0","product":"CONQUEST","region":255,"players":0,"max_players":10,"bots":0,"map":"DEVIL´S PIT","secure":false,"dedicated":true,"os":"w"}]}}
(One can clearly see that this is the original curl output which is not further processed by jq at this time.)
Then... after some seconds, it pops this behind the output:
[2026-03-21 13:37:05] Failed with 3
Preface:
(For the following examples I replaced my personal access token with
ABCDEF)Doing a
curlrequest against the Steam API works of course. Note that I need to quote the URL because of characters like?,&and\that would otherwise be (mis-)interpreted by the shell:curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120"Result:
Piping this through
jqalso works as expected:curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" | jq ".response.servers[].name"Result:
Using this command chain as an argument to another command fails of course:
echo curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" | jq ".response.servers[]"Result:
(Explanation:
echoreturns thecurl -s "https://api.steam[..]string which then gets piped intojqwhich then throws an error because that string is of course not valid JSON.)If
echois supposed to process the whole rest of the line as argument, I need to escape the pipe (|) symbol, which on Windows is done with a^:echo curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" ^| jq ".response.servers[]"Result:
(This works exactly as I would expect now.)
Issue:
Now, replacing the
echowithwatch, I would expect thatwatchalso takes the whole rest of the line as its argument and runs it periodically:watch curl -s "https://api.steampowered.com/IGameServersService/GetServerList/v1?key=ABCDEF&filter=appid\42120" ^| jq ".response.servers[]"Result:
(One can clearly see that this is the original
curloutput which is not further processed byjqat this time.)Then... after some seconds, it pops this behind the output: