I ran into the same issue earlier this year and suggested a fix on this and
the wiki mailing list (before they were moved, so you may not be able to
see it in archives). The change is as you suspect with the parsing argument
of jq, see here in diff style format what worked for me:
# download api data with curl into a file json-data.out
-cat json-data.out | jq -r '.[] | "route addprivate
+cat json-data.out | jq -r '.encap[] | "route addprivate
\(.network)/\(.maskLength) encap \(.gatewayIP)"' >> encap.txt
-andreas K6OTT
On Thu, Apr 25, 2024 at 3:32 PM Lee D Bengston via 44net <
44net(a)mailman.ampr.org> wrote:
Hello,
If I use the line from the Wiki below in order to retrieve the file via
API (and convert it back to the text forma), I get a parsing error -
presumably from jq. If I download only the file taking jq out of the
equation, it's not a json file, but rather, a HTML file. I assume that's
why there's a parsing error when jq reads it. Is the info from the Wiki out
of date?
Thanks,
Lee K5DAT
curl -s
https://user:key@portal.ampr.org/api/v1/encap | jq -r '.[] | "route
addprivate \(.network)/\(.maskLength) encap \(.gatewayIP)"