# Designing a Tax Form JSON Schema

- Canonical: https://schematax.com/blog/designing-a-tax-form-json-schema
- Author: Schema Tax (https://schematax.com)
- Published: 2026-05-05T14:46:50.000Z
- Updated: 2026-05-05T14:46:50.000Z

A good tax form JSON schema wraps every form in the same envelope (document ID, form type, tax year, page references) and puts the boxes in a fields object. Field names describe meaning, box numbers ride along as metadata, repeated rows become arrays, and each tax year gets a version you can validate against.

## What belongs in a tax form JSON schema envelope?

A tax form JSON schema envelope holds the facts that are true for every form, whatever its type: a document ID, the form type, the tax year, the pages the form came from, and a fields object. The envelope stays identical across W-2s, 1099s and K-1s, so routing code reads it before it looks at any box.

Each envelope property answers one question a consumer always asks first.

- **`document_id`**: which upload is this? A stable ID lets you fetch the record again, link it to a review, and delete it on schedule.
- **`form_type`**: what is it? This is the discriminator. Code that maps fields switches on it before reading anything else.
- **`tax_year`**: which year's version of the form? Box layouts change between years, so the year decides which field set applies.
- **`pages`**: where did it come from? A page range, or a list of pages, ties each record back to the source file when one PDF held several forms.
- **`fields`**: the boxes themselves, as named, typed values.

Two optional properties earn their place in most designs. A `schema_version` string says which revision of your own schema produced the record, which is separate from the tax year. And a `client_reference` echoes an ID the caller sent, so the caller never has to match records by file name.

Here is a JSON Schema fragment for that envelope, written against [JSON Schema draft 2020-12](https://json-schema.org/draft/2020-12). It is an illustrative design, not a published Schema Tax schema; Schema Tax has no public API documentation.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api.example.com/schemas/tax-form-envelope.json",
  "title": "Tax form envelope (example)",
  "type": "object",
  "required": ["document_id", "form_type", "tax_year", "pages", "fields"],
  "properties": {
    "document_id": { "type": "string", "minLength": 1 },
    "schema_version": { "type": "string", "pattern": "^\\d+\\.\\d+$" },
    "form_type": { "enum": ["W-2", "1099-NEC", "1099-MISC", "1099-INT", "1099-DIV", "1099-B", "1098", "1040", "K-1"] },
    "tax_year": { "type": "integer", "minimum": 2000, "maximum": 2100 },
    "pages": {
      "type": "array",
      "items": { "type": "integer", "minimum": 1 },
      "minItems": 1
    },
    "fields": {
      "type": "object",
      "additionalProperties": { "$ref": "#/$defs/field" }
    }
  },
  "$defs": {
    "money": { "type": ["string", "null"], "pattern": "^-?\\d+\\.\\d{2}$" },
    "field": {
      "type": "object",
      "required": ["box", "status"],
      "properties": {
        "box": { "type": "string" },
        "value": {},
        "status": { "enum": ["ok", "blank", "needs_review"] }
      }
    }
  }
}
```

The `$id` uses the placeholder host `https://api.example.com`. Swap in your own host when you publish the schema.

## Tax form field naming conventions that survive new tax years

Tax form field naming conventions hold up across tax years when each name describes what the value means, not where it sits. Use lowercase snake_case, spell words out, name the concept the IRS label describes, and keep the box number out of the name. A name tied to position breaks the first time the IRS renumbers a box.

Recent revisions show why. The current [IRS Instructions for Forms 1099-MISC and 1099-NEC](https://www.irs.gov/instructions/i1099mec) label nonemployee compensation as Box 1a and describe new boxes 1b, 1c and 1d added beside it for cash tips, tipped occupation codes and overtime. A field called `box_1` no longer matches any label on that form, and a client keyed on it needs a migration. A field called `nonemployee_compensation` is still correct; only its box metadata changes.

### Naming rules with good and bad examples

| Rule | Good name | Bad name | Why the bad one fails |
| --- | --- | --- | --- |
| Name the meaning, not the position | `wages` | `box_1` | Box 1 means rents on a 1099-MISC and wages on a W-2 |
| Use snake_case, all lowercase | `federal_income_tax_withheld` | `FederalIncomeTaxWithheld` | Mixed case breaks case-sensitive lookups across languages |
| Spell words out | `social_security_wages` | `ss_wgs` | Abbreviations are guessed differently by every reader |
| Keep the form type out of field names | `interest_income` | `int_1099_interest` | The envelope already carries the form type |
| Keep units and formats out of names | `proceeds` | `proceeds_usd_str` | Types belong in the schema, not the name |
| Plural for arrays | `state_lines`, `lots` | `state_line_1`, `state_line_2` | Numbered keys cap the count and duplicate logic |
| Same concept, same name across forms | `federal_income_tax_withheld` on W-2 and 1099 | `fed_wh` on one, `withholding` on another | Shared names let one query span every form |

The last rule makes cross-form work cheap. Federal withholding appears on the W-2, the 1099-NEC, the 1099-MISC, the 1099-INT and the 1099-DIV. If every schema calls it `federal_income_tax_withheld`, one query sums withholding across a household's forms without a lookup table.

Money types are a naming question only in one respect: keep the type out of the name and in the schema. How to represent the amount itself, as a decimal string or a number, is covered in the post on [decimal versus float for money in JSON](/blog/decimal-vs-float-for-money-in-json).

## Modeling repeated rows in a tax form data model

A tax form data model should represent any box that can repeat as an array of objects, not as numbered keys. W-2 Box 12 code pairs, W-2 state and local lines, 1099 state lines, 1099-B sales and K-1 coded items all repeat. An array keeps one shape whether the form holds one row or forty.

Numbered keys look harmless with small counts. A W-2 has four Box 12 slots, so `box12a_code` through `box12d_amount` seems manageable. Then a client writes a loop over letter suffixes, a validator checks eight fields instead of one array rule, and the schema still breaks when a form needs a fifth item. The W-2 overflow rule makes this concrete: the [IRS General Instructions for Forms W-2 and W-3](https://www.irs.gov/instructions/iw2w3) ask employers to issue a separate W-2 for more than four Box 12 items, so consumers end up merging rows from two forms anyway.

An array row carries its own metadata. Each Box 12 row can hold the slot label it came from (`12a`), the code and the amount. Each state row holds the state, the state ID, the state wages and the state tax together, so a consumer never pairs the wrong state with the wrong amount.

The JSON Schema for an array of rows is short:

```json
{
  "box12": {
    "type": "array",
    "maxItems": 4,
    "items": {
      "type": "object",
      "required": ["code", "amount"],
      "properties": {
        "box": { "type": "string", "pattern": "^12[a-d]$" },
        "code": { "type": "string", "pattern": "^[A-Z]{1,2}$" },
        "amount": { "$ref": "#/$defs/money" }
      }
    }
  }
}
```

Three forms push this pattern furthest. The W-2's Box 12 and state lines are shaped in detail in the [W2 extraction API field map](/blog/w2-extraction-api-typed-w-2-fields). A consolidated brokerage statement can hold hundreds of sales, and the [1099-B JSON format for lots and wash sales](/blog/1099-b-json-format-lots-basis-wash-sales) shows a lot array built for that. A K-1 mixes boxes and codes, which the [K-1 JSON schema for boxes, codes and Part III](/blog/k-1-json-schema-boxes-codes-part-iii) models as code-keyed rows.

## Should a tax form JSON schema key on box numbers or field names?

A tax form JSON schema should key on field names and carry box numbers as metadata on each field. The name gives code a stable handle across form types and tax years. The box number lets a person find the value on the printed page. Dropping either one costs you something.

Box numbers alone are ambiguous across forms. On a W-2, Box 1 is wages. On a 1099-MISC, the IRS instructions label Box 1 as rents. On a 1099-INT, the [IRS Instructions for Forms 1099-INT and 1099-OID](https://www.irs.gov/instructions/i1099int) label it interest income. A key like `"1"` means three different things depending on the envelope, and any code that forgets to check the form type first will mix them up. The post on [box numbers versus field names on tax forms](/blog/box-numbers-vs-field-names-on-tax-forms) walks through more of these collisions.

Field names alone lose the link to paper. A reviewer looking at a flagged `social_security_tax_withheld` value wants to know where on the form to look. A preparer reconciling a client's spreadsheet against the form wants the box label next to each number. That is what the box metadata is for.

Keep the box label as a string, never a number. W-2 boxes run from `a` to `f` before the numbered ones, Box 12 has slots `12a` to `12d`, and the 2026 W-2 splits Box 14 into `14a` and `14b`. An integer type cannot hold any of those.

## Versioning a tax form JSON schema when the IRS revises a form

Versioning a tax form JSON schema means letting the tax year select the field set while your own schema version tracks changes to your design. When the IRS moves, splits or adds a box, keep the existing field name, update its box metadata for the new year, and add new fields as optional, so older clients keep working.

The IRS revises forms often enough that this is a yearly task. Two recent changes show the common patterns.

**Boxes are added next to an existing one.** The 1099-MISC and 1099-NEC instructions describe new boxes on the 1099-NEC: 1b for cash tips, 1c for Treasury tipped occupation codes and 1d for overtime compensation, with nonemployee compensation labeled Box 1a. On the 1099-MISC they add Box 13a for cash tips, 13b for tipped occupation codes and Box 14 for overtime. With meaning-based names, the existing field needs only a metadata update: `nonemployee_compensation` carries `"box": "1a"` for the new year. The new boxes become new optional fields.

**A box is split.** The [IRS General Instructions for Forms W-2 and W-3](https://www.irs.gov/instructions/iw2w3) say Box 14 "has been split into box 14a and box 14b": 14a for other items and 14b for Treasury tipped occupation codes. A schema that had one `box14_other` array keeps it for 14a and adds `tipped_occupation_codes` for 14b.

A few rules keep revisions from breaking clients:

- **Add, do not rename.** A renamed field is a breaking change. A new optional field is not.
- **Never reuse a name for a different meaning.** If a concept disappears, retire its name. Do not give it to a new box.
- **Scope enums by year.** If you validate W-2 Box 12 codes against a list, keep a list per tax year. The 2026 W-2 instructions add codes TA, TP and TT, and a 2025 list would reject them.
- **Bump `schema_version` for design changes only.** A new tax year is data. A change to your envelope or naming is a version.

Old records stay valid under the version they were written with. A consumer that reads `tax_year` and `schema_version` together can always pick the right field set.

## Validating payloads against a tax form JSON schema

Validating payloads against a tax form JSON schema catches shape errors before they reach a database: a missing tax year, a money value with three decimals, an unknown form type. Run validation in CI against sample payloads for every form and year, and again at ingest, so a bad record is rejected where it arrives.

In CI, keep a folder of example payloads per form type and tax year, using fictional values only. Each build validates every example against the schema. When someone edits the schema, the examples prove that existing payloads still pass, and a new example for the new tax year proves the change works. This is the cheapest guard against an accidental breaking change.

At ingest, validate every incoming payload before writing it. Reject or quarantine anything that fails, with the validator's error path logged, so the sender knows exactly which property broke.

Two details of JSON Schema trip people up.

First, `format` does not validate by default. The [JSON Schema 2020-12 validation specification](https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-01.html) lets implementations treat `format` as an assertion, but says that evaluation "MUST be disabled by default". A field declared as `"format": "date"` will accept any string unless you turn format assertion on in your validator. If you rely on it, enable it, or use a `pattern` instead.

Second, a `date` format means the "full-date" rule from [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339), which is a profile of ISO 8601: `2026-03-14`, not `03/14/2026`. Tax forms print dates in many styles, so normalize them before validation.

Money deserves its own rule. If amounts are strings, a pattern such as `^-?\d+\.\d{2}$` enforces exactly two decimals. If amounts are numbers, `multipleOf: 0.01` looks right, but the validation specification defines it as valid "only if division by this keyword's value results in an integer", and the [JSON specification, RFC 8259](https://www.rfc-editor.org/rfc/rfc8259), notes that parsers approximate numbers within the precision they support. Test that pairing in your own validator before you trust it, or use strings.

Schema validation checks shape, not truth. It cannot tell you that W-2 Box 4 is 6.2% of Box 3. Those cross-field checks belong in code that runs after validation. Schema Tax runs that kind of check while reading each form, and the [forms Schema Tax reads](/#forms) each come with their own fixed field set. For the next step after validation, the [Excel, CSV and JSON category](/blog/category/excel-csv-json) covers turning checked records into spreadsheets and files, and the [1099 extraction API guide](/blog/1099-extraction-api-nec-misc-int-div-b) shows how one envelope carries several 1099 types.
