When formatting JSON format including double type by jq command on Linux, there is a case that it becomes an integer.
To make the JSON returned by the API easier to read, jq commands can be piped together. However, if a double number such as 1.0000 is returned in a JSON string, if jq commands are piped together, the fractional part will be omitted.
[ec2-user@humidai ~]$ echo '{"key":1.0001}' | jq .
{
"key": 1.0001 ★OK
}
[ec2-user@humidai ~]$ echo '{"key":1.0000}' | jq .
{
"key": 1 ★NG
}
This was an event that caused a bit of troubling behavior.


コメント