$floor
$floor(number?) -> numberCompact type signature
<n-:n>If number is omitted, the current context value is used.
Source: JSONata
Documentation
Returns the value of number rounded down to the nearest integer that is smaller or equal to number.
Examples
Basic usage
$floor(5)=>5$floor(5.3)=>5$floor(5.8)=>5$floor(-5.3)=>-6
Round a lab value down
Input
This example uses the labs example input. The expression reads the first lab result's value and rounds it down.
Example input
JSON
[
{
"code": "LAB-1001",
"display": "hemoglobin A1c",
"value": 5.4,
"unit": "%",
"collectedAt": "2026-02-10T08:15:00Z",
"interpretation": "normal",
"note": "fasting sample"
},
{
"code": "LAB-1002",
"display": "total cholesterol",
"value": 212,
"unit": "mg/dL",
"collectedAt": "2026-02-10T08:15:00Z",
"interpretation": "high",
"note": "repeat in 3 months"
},
{
"code": "LAB-1003",
"display": "creatinine",
"value": 0.9,
"unit": "mg/dL",
"collectedAt": "2026-03-09T12:05:00Z",
"interpretation": "normal",
"note": ""
},
{
"code": "LAB-1004",
"display": "vitamin D",
"value": 18,
"unit": "ng/mL",
"collectedAt": "2026-03-09T12:05:00Z",
"interpretation": "low",
"note": "supplement recommended"
},
{
"code": "LAB-1005",
"display": "thyroid stimulating hormone",
"value": null,
"unit": "mIU/L",
"collectedAt": "2026-03-09T12:05:00Z",
"interpretation": "pending",
"note": "result not available yet"
}
]
Expression
$floor($[0].value)
Result
5