Skip to content
Snippets Groups Projects

update jq filtering

1 file
+ 9
3
Compare changes
  • Side-by-side
  • Inline
+ 9
3
@@ -135,14 +135,20 @@ else
_header=$(echo "$out" | sed -n "1,${iHeaderEnd}p")
_body=$( echo "$out" | sed -n "${iHeaderEnd},\$p")
# --- jq filter
if [ -n "$sJq" ]; then
_body=$( jq "$sJq" <<< "$_body" 2>/dev/null )
if [ -z "$_body" ]; then
ph.setStatus critical
sProblems+="- jq filter [$sJq] was applied and resulted in an empty result.\n"
sProblems+="- jq filter [$sJq] was applied and resulted in an empty result. The reponse from url was no JSON.\n"
else
sInfos+="- jq filter [$sJq] was applied.\n"
sInfos+="${_body}"
if [ "$_body" = "null" ]; then
ph.setStatus critical
sProblems+="- jq filter [$sJq] does not match on responded JSON.\n"
else
sOK+="- jq filter [$sJq] matches.\n"
sInfos+="Content aufter jq filter: ${_body}"
fi
fi
fi
Loading