Short answer
To design a reusable document extraction schema, begin with the business decision or workflow the extracted data must support. Give every field one stable meaning, use predictable names, define its data type and normalized format, and decide exactly how missing or uncertain values should appear. Model repeating information as arrays, separate document data from workflow metadata, and specify which conditions require human review. Before adoption, test the schema against varied synthetic documents and confirm that both operations teams and downstream systems interpret every field consistently.
What you will learn
- Treat the schema as a contract between documents, reviewers, and downstream systems.
- Name fields for their business meaning rather than for a label found on one document.
- Define optionality, null handling, data types, formats, and review conditions explicitly.
- Use objects for related fields and arrays for genuinely repeating records such as invoice lines.
- Add a schema version and document type so changes can be managed without silently changing meaning.
- Test with synthetic examples that include missing, ambiguous, malformed, and repeated values.
Start with the workflow, not the document layout
A document extraction schema defines the structured data that a workflow expects to receive from a document. The most reusable schemas are designed around business meaning rather than the visual position or wording of fields on a particular template.
For example, one invoice might use the label “Invoice No.” while another uses “Reference” or “Bill Number.” If all three values serve the same business purpose, the schema can represent them with one stable field such as invoice_number. A field named top_right_reference would preserve a layout detail instead of the meaning and would be difficult to reuse.
Before listing fields, write down what happens after extraction. An accounts payable workflow may need to identify the supplier, detect the invoice number, verify dates, compare totals, and create line-level records. A reporting workflow might need only the supplier, invoice date, currency, and total. The intended action determines which fields belong in the contract.
Avoid collecting values simply because they appear on the page. Each additional field creates naming, validation, review, and maintenance work. Include a field when a person, rule, report, or destination system has a defined use for it.
- →What decision will the extracted data support?
- →Which values are required by the next step?
- →Which document variations must use the same schema?
- →Which values should stop or redirect the workflow when missing?
- →Who owns future changes to the data contract?
Give every field one clear and stable meaning
Field names should remain understandable without the original document beside them. Choose a naming convention, document it, and apply it consistently. lower_snake_case works well for JSON because names such as invoice_date and supplier_name are readable and predictable.
Prefer specific business nouns. A generic field such as date becomes confusing when a document contains an issue date, due date, delivery date, and payment date. Likewise, total could refer to a subtotal, tax total, amount paid, or balance due.
Do not use two names for the same concept. If one team uses vendor_name and another uses supplier_name, decide on a canonical term and map document labels to it. A small data dictionary can record the field name, definition, type, format, optionality, examples, and review rules.
Field names should not encode values that may change. For example, tax_20_percent is brittle because the rate may vary. An object with tax_rate and tax_amount preserves the underlying concepts.
- →Use invoice_number instead of reference.
- →Use invoice_date and due_date instead of date_1 and date_2.
- →Use supplier rather than placing supplier_name, supplier_tax_id, and supplier_address at unrelated levels.
- →Use line_items instead of rows when the records represent purchased items.
- →Reserve abbreviations for terms every participating team understands.
Define required, optional, null, and absent values
A required schema field and a value guaranteed to appear on every document are not the same thing. Required may mean that every output must contain the key, even when its value is null. Alternatively, a team may omit keys that are not found. Both approaches can work, but mixing them unpredictably makes downstream logic harder to maintain.
For stable operational contracts, it is often useful to include expected singleton fields and set an unavailable value to null. This lets a receiver distinguish a known field with no extracted value from a field that was never part of that schema version. For repeating fields, use an empty array when no records are present.
Do not use an empty string, zero, false, and null interchangeably. They have different meanings. A zero tax amount may be a valid extracted value. null means there is no usable value. An empty string usually adds ambiguity and should generally be avoided.
Optionality should also reflect business importance. A purchase order number might be optional because not every invoice contains one, yet its absence could still require review for a particular workflow. Keep the data rule and the workflow rule separate: the schema can allow null while the review policy decides when null needs attention.
- →Expected but unavailable singleton: null
- →Repeating group with no entries: []
- →Valid numeric zero: 0 or a documented decimal representation
- →Boolean with a known negative answer: false
- →Field not included in this schema version: omit it
Normalize formats without losing meaning
Documents express equivalent values in many ways. Dates may use slashes, dots, month names, or two-digit years. Amounts may use commas or periods as decimal separators. A reusable document extraction schema should specify a normalized representation for each type.
Use ISO 8601 calendar dates such as 2031-04-18 when the complete date is known. Do not guess when a source value such as 04/05/31 is ambiguous. Route it for review or preserve it as an unresolved source value according to the workflow policy.
For money, store the currency separately from the amount. The team should choose a consistent decimal representation and document it. Decimal strings such as "1250.00" can avoid unintended binary floating-point behavior in systems that need exact monetary values. Whatever representation is selected, use it for subtotals, taxes, line amounts, and totals.
Identifiers should usually remain strings. An invoice number such as 000184 must not become the number 184. Telephone numbers, postal codes, account references, and tax identifiers may also contain leading zeros, spaces, letters, or punctuation.
If downstream users need both the source expression and a normalized value, define both deliberately—for example, due_date_raw and due_date. Do this only where the original text has an operational or audit purpose; duplicating every field can make the contract unnecessarily large.
- →Dates: YYYY-MM-DD when unambiguous
- →Currency: ISO-style code such as USD, EUR, or GBP when stated or reliably determined
- →Monetary amounts: one documented decimal convention
- →Identifiers: strings, even when they contain only digits
- →Percentages: define whether 7.5% becomes "7.5" or "0.075"
- →Booleans: true, false, or null when unknown
Use objects and arrays to preserve relationships
A flat field list may be sufficient for a small form, but related values are usually easier to understand as nested objects. Supplier details can sit inside a supplier object, while totals can be grouped under amounts. This structure helps prevent collisions and makes ownership clearer.
Use arrays only for information that can genuinely repeat. Invoice line items are a natural array because there may be zero, one, or many. Each item should follow the same internal schema. Do not create line_1, line_2, and line_3 fields; that imposes an arbitrary limit and makes processing cumbersome.
Think carefully about values that apply at different levels. Currency may apply to the entire invoice, while a tax rate may differ by line. A purchase order reference could be document-level or line-level depending on the workflow. Put each field at the level where its meaning is accurate.
Keep extracted business data separate from processing metadata. A document_data object can hold invoice values, while a review object can report whether attention is needed and why. This separation prevents workflow statuses from being mistaken for source facts.
- →Object: a related set of named values
- →Array: a repeating set of records with the same shape
- →Document-level field: applies to the whole document
- →Line-level field: applies only to one repeated entry
- →Workflow metadata: describes processing or review, not the document itself
Design review points as part of the schema contract
Human review should not be an informal cleanup step. Define the conditions that make a field need attention and represent them consistently. ParseBuddy lets users define extraction schemas and review fields that need attention, so the implementation team should agree on what “needs attention” means for each workflow.
Useful review conditions include a required operational value being null, an ambiguous date, a malformed identifier, an unrecognized currency, or arithmetic that does not satisfy the team's validation rule. Some fields may be more consequential than others. A missing supplier email might be acceptable, while a missing invoice total might stop an accounts payable handoff.
Review reasons should be specific enough to guide action. “Invalid document” is less useful than “invoice_date is ambiguous” or “line item totals do not match the stated subtotal.” Keep extracted values separate from reviewer corrections so the workflow can distinguish what came from the document from what was later confirmed or changed.
Do not treat validation as proof that a document is genuine or that a charge should be approved. Schema validation checks whether data follows the defined contract. Business authorization remains a separate responsibility.
- →Define which missing fields require attention.
- →Specify accepted date, amount, identifier, and enum formats.
- →List cross-field checks, such as due_date not preceding invoice_date.
- →Use clear reason codes or messages.
- →Record the final reviewed value according to the team's data-governance policy.
Wrap the data in a versioned JSON structure
A reusable output should identify the document type and schema version before presenting the fields. Versioning gives receivers a way to handle intentional changes. Adding an optional field may be compatible with existing consumers, but renaming a field, changing its type, or moving it to a new object can break them.
Use a deliberate change process. First define the proposed change and its business reason. Then identify every workflow or receiver that uses the affected field. Update examples and validation rules, test with synthetic documents, and communicate the version transition.
A practical envelope can contain schema_version, document_type, document_data, and review. If source tracking is needed, add only metadata the workflow can provide and use. Avoid placing temporary implementation details into a long-lived external contract.
ParseBuddy can return structured JSON and send completed results through outbound webhooks. Teams using that workflow should agree on the receiving contract before they configure the handoff, including how the receiver will handle nulls, arrays, review states, and future schema versions.
- →Increment the version when a change affects interpretation.
- →Never reuse an old field name with a new meaning.
- →Publish one canonical example for each document type.
- →Test receivers against null values and empty arrays.
- →Keep version transition rules with the schema documentation.
Test the contract with variation, not just ideal samples
A schema that works for one clean document is not yet reusable. Build a compact synthetic test set covering the variations the team expects. Include changed labels, reordered sections, multiple pages, optional fields, repeated lines, and different date or amount presentations.
Negative tests are especially valuable. Try a missing total, an ambiguous date, a duplicated invoice number, a line with no quantity, and a currency symbol with no currency code. The expected outcome should be explicit: a normalized value, null, an empty array, or a review reason.
ParseBuddy supports workflows involving PDFs, images, spreadsheets, and inbound email attachments within the limits shown in the application. When a workflow accepts more than one supported input type, test whether the same business fields produce the same JSON contract across those inputs. The schema should describe the output meaning rather than the file format.
Finish with a joint review. Operations should confirm that the fields support real decisions. Implementation teams should confirm that data types and structures are unambiguous. The receiving system's owner should confirm that the payload can be accepted without undocumented assumptions.
- →Happy path with all expected values
- →Missing optional and operationally required values
- →Ambiguous or malformed dates and amounts
- →Zero, one, and many repeated records
- →Unexpected labels or section order
- →Each supported input type used by the planned workflow
- →Old and new schema versions during a transition
Example workflow
From document to usable data
1. Define the business outcome
Describe the action, decision, report, or handoff that will use the extracted data. Remove fields that have no identified consumer.
2. Inventory document concepts
List the business values that appear across representative synthetic documents. Group equivalent labels under one canonical concept.
3. Create the field dictionary
For every field, record its name, definition, type, format, location in the JSON structure, optionality, example, and owner.
4. Set missing-value and normalization rules
Choose how nulls, empty arrays, dates, identifiers, decimals, currencies, percentages, and booleans will be represented.
5. Model nested and repeating data
Use objects for related values and arrays for repeated records. Confirm whether each value belongs at document or item level.
6. Define review conditions
List the missing, ambiguous, malformed, or inconsistent values that need attention and write a clear reason for each condition.
7. Add the output envelope and version
Place the business fields within a consistent JSON structure that identifies the document type, schema version, and review state.
8. Test and approve the contract
Run varied synthetic examples, compare expected and actual structures, and obtain approval from operations, implementation, and receiving-system owners.
Synthetic product demonstration
Fictional invoice → structured JSON
Fields to capture
- • Supplier: Cedar & Finch Office Goods — fictional organization
- • Invoice number: FIC-000184
- • Invoice date: 18 April 2031
- • Due date: 18 May 2031
- • Purchase order: not shown
- • Currency: USD
- • Line 1: Archive boxes, quantity 10, unit price 12.50, line amount 125.00
- • Line 2: Label packs, quantity 4, unit price 8.75, line amount 35.00
- • Subtotal: 160.00
- • Tax: 12.80
- • Total: 172.80
- • Example note: All names, references, dates, and amounts are synthetic.
{
"schema_version": "1.0",
"document_type": "invoice",
"document_data": {
"supplier": {
"name": "Cedar & Finch Office Goods"
},
"invoice_number": "FIC-000184",
"invoice_date": "2031-04-18",
"due_date": "2031-05-18",
"purchase_order_number": null,
"currency": "USD",
"line_items": [
{
"description": "Archive boxes",
"quantity": "10",
"unit_price": "12.50",
"line_amount": "125.00"
},
{
"description": "Label packs",
"quantity": "4",
"unit_price": "8.75",
"line_amount": "35.00"
}
],
"amounts": {
"subtotal": "160.00",
"tax": "12.80",
"total": "172.80"
}
},
"review": {
"required": true,
"reasons": [
{
"field": "document_data.purchase_order_number",
"reason": "Purchase order number is absent and this example workflow requires review when it is not provided."
}
]
}
}Frequently asked questions
Should every value found on a document become a schema field?
No. Include values that support a defined decision, validation, report, or handoff. Extracting unused data increases maintenance and review work without improving the workflow.
Should a missing field be omitted or set to null?
Choose one documented rule. For expected singleton fields, null often makes the contract more predictable. Omission can indicate that a field does not exist in that schema version. Use an empty array for a repeating group with no records.
Are required fields always present on the source document?
No. Required can mean the output key must exist or that the workflow needs a value before proceeding. Define both schema requirements and operational review rules so the distinction is clear.
How should invoice amounts be represented in JSON?
Use one consistent decimal convention and keep currency separate. Decimal strings are a practical choice when exact monetary representation matters, but every receiver must agree on the type and format.
When should a schema use nested objects?
Use an object when fields form a meaningful group, such as supplier details or invoice amounts. Use arrays for groups that repeat, such as line items. Avoid nesting that adds structure without clarifying meaning.
What changes require a new schema version?
Renaming fields, changing meanings or data types, moving fields, and altering null or array behavior can affect consumers and should trigger deliberate version management. Even compatible additions should be documented.
How does ParseBuddy fit into this workflow?
ParseBuddy turns uploaded documents and supported email attachments into structured data. Users can define extraction schemas, review fields that need attention, return structured JSON, and send completed results through outbound webhooks. Supported inputs and applicable limits are shown in the application.
Turn your field list into a reusable extraction contract
Start with one document type and one downstream workflow. Define stable field names, formats, missing-value behavior, arrays, and review rules before testing the schema with varied synthetic documents. In ParseBuddy, you can define the extraction schema, review fields that need attention, and return the completed result as structured JSON or send it through an outbound webhook.
Start free — no card required