Skip to content
AnswerWell geo Documentation

Research · 5 min read · Answerwell

Integer Type: HTML Microsyntax and Structured Data Properties

How HTML defines valid integers, how Schema.org Integer differs from Number and Float, and which properties require whole-number values.

This page summarises the WHATWG HTML living standard rules for parsing signed integers in HTML microsyntax, and the Schema.org vocabulary, where dozens of properties expect values of type Integer rather than Float. Together, these sources define when a whole number is valid in markup and in JSON-LD or other structured data.

HTML valid integer: what counts as a signed whole number

Section titled “HTML valid integer: what counts as a signed whole number”

In HTML, many attributes and parsing algorithms consume a valid integer: a string of one or more ASCII digits, optionally prefixed with U+002D HYPHEN-MINUS (-).

A string is a valid integer if it consists of one or more ASCII digits, optionally prefixed with a U+002D HYPHEN-MINUS character (-).

A valid integer without a U+002D HYPHEN-MINUS (-) prefix represents the number that is represented in base ten by that string of digits. A valid integer with a U+002D HYPHEN-MINUS (-) prefix represents the number represented in base ten by the string of digits that follows the U+002D HYPHEN-MINUS, subtracted from zero.

— WHATWG, 2.3 Common microsyntaxes — Edition for Web Developers

Plain terms: only digits (and an optional leading minus) are allowed—no decimal point, no spaces, no thousands separators, and no + sign in this microsyntax. A browser or parser that follows HTML uses these rules when interpreting integer-valued content in the HTML layer, which is separate from how you type numbers in JSON-LD.

Schema.org groups numeric literals under the Number data type. More specific types include Float and Integer:

Float
Integer

— Schema.org, Number

An Integer value is a whole number. Properties that declare Integer as the expected type reject fractional values for correct typing, even though generic JSON parsers accept 3.14 as a number. When a property’s documentation says the value is Integer, use a whole number (typically written in JSON without a fractional part, e.g. 42 not 42.0 if your toolchain treats that as a float).

Concept Typical use Fractional values
Number Parent type for numeric values Depends on concrete property
Integer (child of Number) Counts, capacities, day/month indices No
Float (child of Number) Measurements needing decimals Yes

Schema.org properties that expect Integer values

Section titled “Schema.org properties that expect Integer values”

Most of this cluster consists of individual Schema.org properties whose “Values expected to be one of these types” section is simply Integer. That pattern means: annotate the property with a whole number, not a float string and not a non-numeric type.

The list below groups common properties by meaning. Each name links to its canonical Schema.org definition; every linked property in this cluster documents Integer as the expected value type.

Engagement, catalog, and content metrics often use Integer:

Property Typical meaning
answerCount Number of answers
commentCount Number of comments
reviewCount Number of reviews
ratingCount Number of ratings
upvoteCount Upvotes
downvoteCount Downvotes
userInteractionCount User interactions
wordCount Word count
offerCount Number of offers
numberOfItems Items in a list or order
numberOfPages Pages
collectionSize Collection size

Season, episode, and track counts are Integer properties:

Property Typical meaning
numberOfSeasons Seasons in a series
numberOfEpisodes Episodes
numTracks Tracks
numberOfBathroomsTotal Bathrooms (whole rooms)
productReturnDays Return window in days

Capacity and enrollment fields use whole numbers:

Property Typical meaning
maximumAttendeeCapacity Max attendees
maximumPhysicalAttendeeCapacity Max in-person attendees
maximumVirtualAttendeeCapacity Max virtual attendees
remainingAttendeeCapacity Seats remaining
maximumEnrollment Enrollment cap
totalHistoricalEnrollment Historical enrollment total
repeatCount Repeat occurrences

Recurrence helpers in Schema.org also expect Integer components (for example, month index or day-of-month), as defined on:

Consult each property page for allowed ranges and how it combines with parent types; the shared requirement from the cluster is type Integer, not Float.

Property Typical meaning
requiredMinAge Minimum age
requiredMaxAge Maximum age
totalJobOpenings Job openings count
playersOnline Players online
numConstraints Number of constraints

For any property above, open its Schema.org page and confirm under “Values expected to be one of these types” that Integer is listed—the cluster sources all show that single type for these URLs.

Common mistakes when using Integer in markup and structured data

Section titled “Common mistakes when using Integer in markup and structured data”

Using decimals for Integer properties. Values like 4.5 for numberOfBathroomsTotal conflict with the documented Integer type even if the value is “almost” whole.

Quoting numbers when the toolchain expects a JSON number. JSON-LD usually uses numeric literals ("reviewCount": 120). Putting "120" in quotes may still work in some pipelines, but it is not the same as typing an Integer in Schema.org’s sense; follow your serializer and the property definition.

Confusing HTML parsing with JSON-LD. Fixing an HTML attribute using the valid integer rules does not automatically fix structured data on the page; validate both layers if you use both.

Treating all numbers as Number. Use Number as the umbrella type, but each property page names the specific expectation—when it says Integer, do not substitute Float.

  1. Pick a property you publish (for example reviewCount) and open its Schema.org page; confirm the value you emit is typed and formatted as a whole number matching Integer.
  2. For values also carried in HTML microsyntax, compare the string against the signed integer rules (digits only, optional leading -).
  3. Cross-check parent type expectations on Number so you do not use Float where a linked property requires Integer.
  4. Re-scan a sample of JSON-LD on your pages for fractional values on properties from the tables above (counts, capacities, recurrence fields).
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.