Useful primitives for class based Json Schema Validation package json.
Common primitives are provided such as JsonDate, JsonEmail, and JsonUrl, that are not considered strict json.
The interface uses common types such as Date but serializes to strict json as a number.
Additionally, included are common enumerations representing international formats such as County codes and Currencies.
For more details see json.
Instantiate or extend from one of the provided json primitives.
Enumeration that resolves to an ISO 3166-1 alpha-2 country code.
new JsonCountry(
lowercase:boolean, // Lowercase country
value?:Country // Default value
);Enumeration that resolves to an ISO 4217 currency.
new JsonCurrency(
lowercase:boolean, // Lowercase currency
value?:Currency // Default value
);Date that serializes to the amount of elapsed time since the Unix epoch.
new JsonDate(
milliseconds:boolean, // Milliseconds or seconds
min?:Date, // Minimum date value
max?:Date, // Maximum date value
value?:Date // Default value
);Regular expression that validates against the majority of valid email inputs.
new JsonEmail(
value?:string // Default value
);Enumeration that resolves to an ISO 3166-2:US subdivision code.
new JsonState(
lowercase:boolean, // Lowercase state
value?:Country // Default value
);Date that serializes to an ISO 8601 time string.
new JsonTimestamp(
min?:Date, // Minimum date value
max?:Date, // Maximum date value
value?:Date // Default value
);Utilizes URL for validation of url inputs.
new JsonUrl(
value?:URL // Default value
);