Skip to main content

$ceil

$ceil(number?) -> number
Compact type signature<n-:n>

If number is omitted, the current context value is used.

Browse categories

Source: JSONata

Documentation

Returns the value of number rounded up to the nearest integer that is greater than or equal to number.

Examples

Basic usage

  • $ceil(5) => 5
  • $ceil(5.3) => 6
  • $ceil(5.8) => 6
  • $ceil(-5.3) => -5

Round a lab value up

Input

This example uses the labs example input. The expression reads the first lab result's value and rounds it up.

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

$ceil($[0].value)

Result

6