Short answer
To design a document extraction schema that teams can reuse, model the business meaning of the data rather than the visual layout of one document. Give every field a stable and descriptive name, distinguish required fields from optional ones, define one output format for dates and numbers, and decide what should happen when a value is missing or uncertain. Organize related data into predictable JSON objects and arrays, then document the review conditions that should stop or flag downstream processing. Test the schema against several synthetic document variations before treating it as a shared operational contract.
What you will learn
- Name fields for what the values mean, not where they appear on a page.
- Use stable names and data types across document layouts, senders, and workflow versions.
- Make a field required only when the next business step truly cannot proceed without it.
- Represent missing values consistently instead of using blanks, guesses, or ambiguous placeholder text.
- Normalize dates, amounts, currencies, identifiers, and repeated rows before downstream use.
- Define review points around business risk, extraction uncertainty, and cross-field conflicts.
- Keep raw source text separate from normalized values when both are operationally useful.
- Test the schema with fictional variations, including missing, malformed, and contradictory data.
Start with the downstream decision
A document extraction schema is a contract between the source document, the extraction workflow, reviewers, and the system or team receiving the result. The best starting point is not a sample PDF or spreadsheet. It is the decision or action that follows extraction.
Ask what the receiving team needs to approve, route, reconcile, enter, or investigate. An accounts workflow might need a document number, issue date, currency, total, supplier reference, and line items. It may not need decorative headers, marketing text, or every address printed on the page.
This distinction prevents a common design problem: recreating the entire document as JSON. Capturing every visible label increases complexity without necessarily helping the next step. A reusable schema should include values with a clear operational purpose.
Write a short purpose statement before listing fields. For example: “This schema captures the identifiers, dates, parties, totals, and line items needed to review a fictional purchase document and pass an accepted result to a downstream workflow.” That statement gives implementation teams a boundary for later decisions.
- →What action happens after extraction?
- →Which values are necessary for that action?
- →Which missing values must block the action?
- →Which values are helpful but nonessential?
- →Who owns the definition of each field?
Choose field names that survive layout changes
Field names should describe business meaning rather than page position or a particular sender’s wording. A field called invoice_number is more reusable than top_right_value. Likewise, supplier_name is more stable than vendor_header, even if one document uses “Vendor” and another uses “Supplier.”
Choose one naming convention, such as snake_case, and apply it everywhere. Avoid spaces, punctuation, unexplained abbreviations, and names that change meaning between document types. Stability matters because downstream mappings, webhooks, reports, and review instructions may rely on these names.
Be specific enough to avoid collisions. date is unclear when a document can contain an issue date, due date, delivery date, and service date. Prefer issue_date and due_date. total is similarly ambiguous; subtotal_amount, tax_amount, and total_amount communicate distinct meanings.
Create a compact field dictionary alongside the schema. For each field, record its definition, type, required status, expected format, missing-value behavior, and review rule. This dictionary helps operations managers and implementers resolve questions without reverse-engineering previous documents.
- →Prefer document_number over reference unless the field truly accepts several reference types.
- →Prefer buyer_name and supplier_name over party_1 and party_2.
- →Prefer total_amount over grand_total_box.
- →Use the same field name for the same concept across layouts.
- →Use different field names when similar-looking values have different meanings.
Separate required, optional, and conditional values
Not every useful field should be required. If too many fields are mandatory, normal document variations create unnecessary exceptions. If too few are mandatory, incomplete results can move downstream without the information needed to use them.
A required field should be one whose absence prevents the intended next step. An optional field may improve context but does not block processing. A conditional field becomes necessary only when another value or document condition applies.
For example, purchase_order_number might be optional in the general schema but required when order_type is purchase_order. tax_amount might be optional when no tax is charged. A line description may be required for human review even when a machine destination primarily uses an item code.
Use null for a known field whose value is absent or cannot be determined. Do not substitute an empty string, zero, “N/A,” or a guessed value unless that representation has been explicitly defined. Zero is a real numeric value, while null means no usable value was provided or established.
Arrays need an equally clear rule. Decide whether no line items should appear as an empty array or trigger review because line items were expected. Consistency is more important than choosing a universal convention.
- →Required: processing cannot safely continue without the value.
- →Optional: the value is useful but its absence does not block the workflow.
- →Conditional: the value is required only under a documented condition.
- →Null: the field exists in the schema, but no usable value is available.
- →Empty array: the repeated group contains no entries, if that state is valid.
Define formats before extraction begins
A schema should say not only which values to capture, but also how to represent them. Without format rules, the same date may arrive as 04/07/2032, 7 Apr 2032, or April 7, 2032. The ambiguity becomes a downstream problem.
Use a consistent date representation such as YYYY-MM-DD when the complete date is available and unambiguous. Keep monetary amounts as numbers rather than strings containing currency symbols or separators. Store the currency separately using the code expected by the receiving workflow.
Identifiers deserve different treatment from quantities. A document number such as PB-004281 should remain a string. Postal codes, account references, and item codes may contain leading zeros or letters, so converting them to numbers can damage the value.
If the original text matters for audit or review, preserve it in a separate source field rather than mixing raw and normalized forms. For example, issue_date_raw could contain “7 April 2032,” while issue_date contains “2032-04-07.” Only add paired fields when the workflow has a real reason to use both.
For repeated information, use arrays of consistently shaped objects. Every line item should follow the same field structure, even when some optional values are null. This makes the result easier for people to inspect and for receiving systems to process.
- →Dates: use one documented representation.
- →Amounts: use numeric values without currency symbols.
- →Currency: store separately from the amount.
- →Identifiers: preserve as strings, including leading zeros.
- →Booleans: use true or false rather than yes, no, Y, or N.
- →Repeated rows: use arrays with a stable object structure.
Design JSON around clear business objects
Flat JSON can work for a small document, but grouping related fields usually improves reuse. A document object can hold type, number, and dates. Supplier and buyer objects can hold party information. A totals object can contain subtotal, tax, and total amounts. Line items belong in an array.
Avoid nesting merely to imitate boxes on the page. Nesting should clarify relationships. It should also stay shallow enough for reviewers and implementation teams to understand without tracing through many layers.
Decide whether operational metadata belongs in the same payload as extracted document values. If included, keep it in a clearly named object such as processing or review. Do not mix review status into financial totals or source identifiers.
Version the schema deliberately. A version value helps teams identify the expected contract when fields are introduced or reorganized. Additive changes, such as a new optional field, may be easier to adopt than renaming or changing the type of an existing field. Treat renames, removals, and type changes as compatibility decisions rather than simple edits.
- →Group fields by meaning, not page region.
- →Keep object names stable across document variations.
- →Use arrays only for genuinely repeated records.
- →Separate extracted values from workflow or review information.
- →Include a documented schema version when multiple versions may exist.
Place review points where errors matter
Review rules should reflect operational risk, not just whether a field was found. ParseBuddy users can define extraction schemas and review fields that need attention. The team still needs to decide which conditions deserve attention and what a reviewer should verify.
Start with missing required fields. Then add cross-field checks that expose contradictions, such as a total that does not agree with the expected combination of subtotal and tax, a due date before the issue date, or a line quantity that is present without a unit price when both are required by the workflow.
Review may also be appropriate when document wording is ambiguous, a value has an unexpected format, or two plausible values compete for the same field. Do not silently choose a convenient value when the distinction affects approval, payment, routing, or another consequential action.
Document the reviewer’s response. Should the reviewer correct the value, set it to null, reject the document, or route it for investigation? A flag without an ownership rule can simply move uncertainty from extraction to operations.
- →A required value is missing.
- →A value cannot be normalized to the expected type or format.
- →Two candidate values could fill the same field.
- →Dates conflict with an established business rule.
- →Totals or repeated rows do not reconcile under the workflow’s rules.
- →A document condition makes an otherwise optional field mandatory.
Test for reuse with document variations
A schema is not reusable merely because it works on one clean sample. Test it against synthetic documents with different labels, layouts, date styles, currencies, optional sections, and line-item counts. Include difficult cases rather than only ideal inputs.
Useful tests include a missing purchase order number, a zero tax amount, a multiline description, a document number with leading zeros, an absent due date, and two totals with unclear labels. Also test documents that should not match the schema at all.
For every test, compare the result with an expected JSON fixture. Check field names, types, null behavior, array structure, normalization, and review outcomes. When a result differs, determine whether the extraction setup, field definition, or schema itself needs to change.
ParseBuddy turns uploaded documents and supported email attachments into structured data. Supported workflows include PDFs, images, spreadsheets, and inbound email attachments within the limits shown in the application. Teams should test the actual file types and input routes they plan to use, while keeping the schema focused on shared business concepts.
The service can return structured JSON and send completed results through outbound webhooks. Before connecting an outbound webhook to a production workflow, confirm that the receiving endpoint accepts the documented field names, types, nulls, arrays, and schema version.
- →Test more than one layout.
- →Include valid missing values and invalid missing values.
- →Test zero separately from null.
- →Test one, many, and no repeated rows where permitted.
- →Confirm the receiver can handle every documented state.
- →Retest when a field name, type, rule, or structure changes.
Maintain the schema as a shared contract
Assign an owner who can approve field definitions and compatibility changes. Operations should explain the business requirement, while implementation teams should identify structural and downstream consequences. Neither perspective is sufficient on its own.
Keep a change log that states what changed, why it changed, whether the change is compatible, and which workflows need retesting. Avoid quietly repurposing an existing field. If supplier_reference originally means the supplier’s account reference, it should not later become a general container for any unidentified code.
Review field usage periodically. A field that is never used may be unnecessary. A field repeatedly corrected by reviewers may have an unclear definition, inconsistent source evidence, or an unsuitable format rule. The goal is not the largest possible schema; it is a stable structure that helps teams complete the workflow reliably.
- →Name a schema owner.
- →Publish field definitions and examples.
- →Record changes and compatibility impact.
- →Maintain synthetic test fixtures.
- →Retire fields deliberately rather than changing their meaning.
Example workflow
From document to usable data
1. Define the workflow outcome
Write down the action that follows extraction and the minimum information required to perform it.
2. Inventory business concepts
List identifiers, parties, dates, amounts, repeated rows, and other values that have a clear downstream purpose.
3. Create the field dictionary
Assign each field a stable name, definition, data type, format, required status, null behavior, and owner.
4. Organize the JSON
Group related values into understandable objects and represent repeated records as arrays of consistently shaped objects.
5. Define review conditions
Specify which missing, ambiguous, malformed, or conflicting values need attention and what the reviewer should do.
6. Build synthetic tests
Create fictional documents and expected JSON results covering normal, optional, malformed, and contradictory cases.
7. Validate the receiving workflow
Confirm that the destination can accept every documented data type, null state, array shape, and schema version.
8. Control changes
Assign ownership, record revisions, and retest affected workflows whenever the contract changes.
Synthetic product demonstration
Synthetic purchase invoice → structured JSON
Fields to capture
- • Document label: INVOICE
- • Invoice number: DEMO-004281
- • Issue date: 7 April 2032
- • Due date: not printed
- • Supplier: Northstar Sample Supplies
- • Buyer: Example Operations Workshop
- • Purchase order: PO-00917
- • Currency: USD
- • Line 1: Training folders, quantity 4, unit price 12.50, amount 50.00
- • Line 2: Sample labels, quantity 2, unit price 7.50, amount 15.00
- • Subtotal: 65.00
- • Tax: 0.00
- • Total: 65.00
{
"schema_version": "1.0",
"document": {
"document_type": "invoice",
"document_number": "DEMO-004281",
"issue_date": "2032-04-07",
"due_date": null,
"purchase_order_number": "PO-00917"
},
"supplier": {
"name": "Northstar Sample Supplies"
},
"buyer": {
"name": "Example Operations Workshop"
},
"currency": "USD",
"line_items": [
{
"description": "Training folders",
"quantity": 4,
"unit_price": 12.50,
"line_amount": 50.00
},
{
"description": "Sample labels",
"quantity": 2,
"unit_price": 7.50,
"line_amount": 15.00
}
],
"totals": {
"subtotal_amount": 65.00,
"tax_amount": 0.00,
"total_amount": 65.00
},
"review": {
"needs_attention": false,
"reasons": []
}
}Frequently asked questions
How many fields should a document extraction schema contain?
Include the fields needed for the downstream workflow and justified review context. There is no ideal universal count. Start with the minimum useful contract, then add fields only when they have a defined consumer, rule, or operational purpose.
Should optional fields always appear in the JSON?
Either approach can work, but it must be consistent. Keeping optional fields with null values makes the shape predictable. Omitting them produces a smaller payload but requires receivers to handle absent keys. Document the chosen rule and test it with every receiver.
What is the difference between null, zero, and an empty string?
Null means no usable value is available. Zero is a valid numeric value. An empty string is a string with no characters and is often ambiguous. Do not use these states interchangeably.
Should raw and normalized values both be stored?
Store both only when the original representation supports review, traceability, or another defined need. Give them separate names, such as issue_date_raw and issue_date, so consumers know which value to use.
When should a schema use nested objects?
Use nested objects when fields form a meaningful business group, such as supplier, buyer, totals, or document details. Avoid nesting that merely copies the page layout or creates layers without clarifying relationships.
How should teams handle a new document layout?
First determine whether the new layout contains the same business concepts. If it does, keep the existing schema and adapt the extraction setup. Change the schema only when the workflow genuinely needs a new concept, type, or structure.
Can the completed structured data be sent to another system?
ParseBuddy can return structured JSON and send completed results through outbound webhooks. Teams should verify the receiving endpoint’s expectations for authentication, field names, types, null values, arrays, and schema versions before enabling the workflow.
Build a schema your whole workflow can understand
Start with one document process, define its stable business fields, and create synthetic tests for missing and conflicting values. In ParseBuddy, users can define extraction schemas, review fields that need attention, return structured JSON, and send completed results through outbound webhooks. Check the application for the current limits that apply to PDFs, images, spreadsheets, and inbound email attachments.
Start free — no card required