JSON Schema String Formats

String fields can have an optional format that describes what kind of text is expected — a date, an email, a web link, etc. When provided, it helps validators catch mistakes automatically and makes the schema easier to understand.

Dates & Times

date

A calendar date in ISO 8601 format: YYYY-MM-DD. Use this when the time of day is not relevant.

ValueStatusNote
"2024-01-15"
valid
"2024-02-29"
valid
2024 is a leap year
"January 15, 2024"
invalid
human-readable format, not YYYY-MM-DD
"2024-13-01"
invalid
month 13 does not exist
"2024-01-32"
invalid
day 32 does not exist

time

A time of day in HH:MM:SS format with a required timezone. Use Z for UTC or an offset like +05:30. The timezone cannot be omitted.

ValueStatusNote
"09:30:00Z"
valid
"14:00:00+05:30"
valid
with timezone offset
"09:30:00"
invalid
timezone is required
"9:30am"
invalid
12-hour format is not accepted
"25:00:00Z"
invalid
hour 25 does not exist

date-time

A precise moment in time following ISO 8601: date and time joined by the letter T, with a required timezone.

ValueStatusNote
"2024-01-15T09:30:00Z"
valid
"2024-01-15T09:30:00+02:00"
valid
with timezone offset
"2024-01-15 09:30:00"
invalid
space instead of T, missing timezone
"2024-01-15"
invalid
date only — time and timezone are required

duration

A time interval in ISO 8601 duration format. Starts with P, followed by date components (Y=years, M=months, D=days) and time components after T (H=hours, M=minutes, S=seconds). For example, P1Y6M means 1 year and 6 months.

ValueStatusNote
"P3Y6M4DT12H30M5S"
valid
3 years, 6 months, 4 days, 12 hours, 30 min, 5 sec
"P1Y"
valid
one year
"PT30M"
valid
30 minutes (T required before time components)
"3 hours"
invalid
natural language — ISO 8601 syntax is required
"P"
invalid
empty duration — at least one component is required

Email

email

A standard internet email address. Must contain exactly one @ symbol, with a name before it and a domain after.

ValueStatusNote
"alice@example.com"
valid
"user+tag@sub.example.org"
valid
plus addressing is valid
"alice at example.com"
invalid
spaces and no @ symbol
"alice@"
invalid
missing domain after @
"@example.com"
invalid
missing local part before @
"أليس@example.com"
invalid
non-Latin characters in local part

idn-email

An email address that can include non-Latin characters. Use this instead of email when your users may have addresses in their native script.

ValueStatusNote
"用户@例子.广告"
valid
"alice@example.com"
valid
a regular email is also valid
"用户без-собаки"
invalid
missing @

Web Addresses

hostname

A network hostname — the domain name of a server or website. Each label may contain ASCII letters, digits, and hyphens, but cannot start or end with a hyphen.

ValueStatusNote
"api.example.com"
valid
"localhost"
valid
"my website.com"
invalid
spaces are not allowed
"-api.example.com"
invalid
cannot start with a hyphen

idn-hostname

A network hostname that can include non-ASCII characters, per the Internationalized Domain Names standard. Use this when the domain uses local-script characters.

ValueStatusNote
"münchen.example.de"
valid
"api.example.com"
valid
a regular hostname is also valid
"münchen .de"
invalid
spaces are not allowed

uri

A Uniform Resource Identifier — a complete address that includes a scheme such as https://, ftp://, or mailto:.

ValueStatusNote
"https://example.com/users/42?page=1"
valid
"ftp://files.example.com/report.csv"
valid
"/just/a/path"
invalid
no scheme

uri-reference

A URI that can be either absolute (with a scheme) or relative (just a path). Use this when a link may reference a resource on the same server without repeating the full domain.

ValueStatusNote
"https://example.com/users/42"
valid
absolute path
"/users/42"
valid
relative path
"../other/page"
valid
relative path with parent navigation
"has spaces in it"
invalid
spaces are not allowed in URIs

uri-template

A web address pattern with named placeholders in curly braces that get filled in later.

ValueStatusNote
"https://api.example.com/users/{id}"
valid
"/users/{id}/posts{?page,limit}"
valid
"https://api.example.com/{unclosed"
invalid
unclosed brace

iri

A complete web address that can contain non-Latin characters. The international version of uri.

ValueStatusNote
"https://例子.com/用户/42"
valid
"https://example.com/path"
valid
a regular URI is also valid
"not a url at all"
invalid
no scheme, spaces not allowed

iri-reference

A complete or relative web address that can contain non-Latin characters. The international version of uri-reference.

ValueStatusNote
"https://例子.com/用户/42"
valid
absolute
"/用户/42"
valid
relative path
"has spaces"
invalid
spaces are not allowed

IP Addresses

ipv4

An IPv4 address — four decimal numbers from 0 to 255, separated by dots, used to identify a device on a network.

ValueStatusNote
"192.168.1.1"
valid
"10.0.0.0"
valid
"192.168.1.256"
invalid
256 is out of range — each number must be 0–255
"192.168.1"
invalid
only 3 groups — exactly 4 are required
"192.168.1.1.5"
invalid
5 groups — exactly 4 are required

ipv6

An IPv6 address — eight groups of four hexadecimal digits separated by colons. Consecutive all-zero groups can be shortened to ::.

ValueStatusNote
"2001:0db8:85a3:0000:0000:8a2e:0370:7334"
valid
"::1"
valid
loopback address — compressed
"2001:db8::1"
valid
:: replaces one or more consecutive zero groups
"192.168.1.1"
invalid
this is an IPv4 address, not IPv6
"gggg::1"
invalid
g is not a valid hexadecimal digit

Identifiers

uuid

A Universally Unique Identifier — a 128-bit value formatted as 32 hexadecimal digits in five hyphen-separated groups. Generated independently, UUIDs are statistically guaranteed not to collide.

ValueStatusNote
"550e8400-e29b-41d4-a716-446655440000"
valid
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
valid
"order-12345"
invalid
not a UUID
"550e8400e29b41d4a716446655440000"
invalid
missing hyphens
"urn:uuid:550e8400-e29b-41d4-a716-446655440000"
invalid
URN form is not accepted — use the plain UUID without the urn:uuid: prefix

JSON Pointers

json-pointer

An address that pinpoints a specific value inside a JSON document, like a file path. Each / goes one level deeper: /users/0/name means “the name field of the first item in users”. Must start with /.

ValueStatusNote
"/users/0/name"
valid
"/settings/theme"
valid
""
valid
empty string refers to the whole document
"users/0/name"
invalid
must start with /

relative-json-pointer

Like json-pointer, but starting from your current position in the document rather than the top. A number at the start says how many levels to go up first.

ValueStatusNote
"0"
valid
current position
"1/name"
valid
go up one level, then follow /name
"2/users/0"
valid
"/name"
invalid
must start with a number, not /

Pattern

regex

A regular expression pattern. This format validates that the pattern syntax is correct, not that a given string matches it. To restrict field values to a specific pattern, use the Pattern constraint.

ValueStatusNote
"^[A-Z][a-z]+-[0-9]{4}$"
valid
"[a-z]+"
valid
"\\d{3}-\\d{4}"
valid
"[unclosed"
invalid
unclosed bracket
"*invalid"
invalid
* without something to repeat