I found the difference between json data created by JavaScipt and through jqwith bash (and other programming languages). With JavaScript, I can create decimal numbers with six digits after the period, even when I use float(). But with jqits difference, because adding a decimal value takes only four digits after the decimal point.
My problem is that I need decimal numbers to store in SQL, up to six digits after the period.
Example:
$ JSON='{"decimal":0.00001}'
$ echo "$JSON" | jq .
{
"decimal": 1e-05
}
My goal is to check the decimal with this string ...
if [[ "$TMP_DECIMAL" =~ ^[0-9]+([.][0-9]+)?$ ]] ; then
Any feedback / recommendation?
source
share