Reference
Numeric types
There are two numeric types in JSON Schema: integer and number. They share the same validation keywords.
JSON has no standard way to represent complex numbers, so there is no way to test for them in JSON Schema.
integer
The integer
type is used for integral numbers. JSON does not have
distinct types for integers and floating-point values. Therefore, the
presence or absence of a decimal point is not enough to distinguish
between integers and non-integers. For example, 1
and 1.0
are two
ways to represent the same value in JSON. JSON Schema considers that
value an integer no matter which representation was used.
int
type.Numbers with a zero fractional part are considered integers:
Floating point numbers are rejected:
Numbers as strings are rejected:
number
The number
type is used for any numeric type, either integers or
floating point numbers.
float
type.Need Help?
Did you find these docs helpful?
Help us make our docs great!
At JSON Schema, we value docs contributions as much as every other type of contribution!
Still Need Help?
Learning JSON Schema is often confusing, but don't worry, we are here to help!.