Types of datatype available during the schema validation

Hi Team,
I am validating the response through Schema. As of now I have used datatypes as below listed:


Any additional datatypes available?

Reason behind asking here is I want to verify the double/float and date type values too but unfortunately I can verify through string only.

Here is the sample API response:

“id”: 120000755487,
“balance”: “36.46”,
“currencyCode”: “USD”,
“expiresOn”: “2020-11-21 02:30:00”

Schema Validation:
“id”: { “type”: “integer”},
“balance”: { type: “string” },
“currencyCode”: { type: “string” },
“expiresOn”: { type: “string” },

Here I can verify the balance and expiresOn values with string datatype but want to verify much more deeper like balance could be verify through double or float type and expiresOn could be verify through date type.

P.S. Already noted that values are in double quote so by default they will considered as string.

Hope making understating to you guys.

Here is the documentation for JSON Schema on data types:

Thanks for the documentation, As I can understand there is no such way to accommodate such requirement apart from the regular expression.
Thanks @allen.helton for the prompt response.

Not for floats, but for date-time you can add a format on a string property


Just quick question:
So I was going through the date and time validation, Had below question.

Lets assume my output value is 2020-12-01 02:00:00.000 where I can’t use directly date and time function since format is different.
So trying regular expression as
““pattern”: ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}$”
but some time ms values comes in 4, 5 or 6 digit so how can I ignore the ms sec in regular expression? or how can I add “|” on the regular expression?

If you’re doing schema validation and data comes in not in the expected format (like having extra digits), that should break the validation. That data would be considered invalid.

Business is not worried about mile seconds(ms), Team is okay to exclude ms fields.
Any suggestion further on ?