amazon-textract-response-parser
Easily parse JSON returned by Amazon Textract.
What it is and what it does
This package deserializes and serializes Amazon Textract OCR JSON responses into strongly-typed Python objects using marshmallow schemas. It provides two main layers: a serializer/deserializer for converting raw Textract JSON into TDocument objects, and a pipeline module with reusable components that modify or enrich the response structure—such as reordering blocks by page geometry, calculating page orientation in degrees, merging or linking multi-page tables, and adding OCR confidence scores to key-value pairs.
The library is designed to integrate into existing Textract workflows without requiring major refactoring. It supports both standard Textract responses and AnalyzeId responses, and includes a command-line tool for testing pipeline components. Runtime dependencies are boto3 (for AWS SDK integration) and marshmallow (for schema validation and serialization).
Use it for:
- Deserialize Textract JSON into typed Python objects for downstream document processing or analysis pipelines.
- Reorder OCR blocks by vertical position to reconstruct natural reading order when Textract returns unordered results.
- Detect and correct page rotation by calculating orientation degrees from word and line geometry.
- Merge or link tables that span multiple pages while preserving or enriching geometric accuracy.
- Extract OCR confidence scores for key-value pairs to validate form field extraction quality.
- Build batch processing workflows that transform raw Textract responses into standardized document representations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses JSON responses from Amazon Textract OCR service into typed Python objects, with pipeline components for ordering blocks, detecting page orientation, merging tables, and enriching confidence scores.
Yes, if you are actively using Amazon Textract and need structured Python objects to work with its JSON responses. The low install friction and permissive license make it a practical choice. However, dormant maintenance (no release since 2024-06-13) means you should verify that pipeline components and schema support match your Textract API version before relying on it for production workflows.
Install
amazon-textract-response-parser on PyPI
pip
pip install amazon-textract-response-parseruv
uv add amazon-textract-response-parserpoetry
poetry add amazon-textract-response-parserInstalling amazon-textract-response-parser
Before you install
Low friction install with two stable runtime dependencies (boto3, marshmallow). Maintenance is dormant—last commit was 2024-11-19 but no release since 2024-06-13, so expect no active bug fixes or feature updates.
License in practice
Apache License 2.0 (permissive) allows commercial use, modification, and distribution with minimal restrictions; suitable for most projects.
Quickstart
from amazon_textract_response_parser.trp2 import TDocument, TDocumentSchema
# j is a dict from Textract API response
t_doc = TDocumentSchema().load(j)
# Access parsed document structure
for page in t_doc.pages:
for block in page.blocks:
print(block.text)
Requires an active Amazon Textract API call or pre-existing Textract JSON response dict; boto3 must be configured with AWS credentials.
Verify before relying
- Whether pipeline components (order_blocks_by_geo, add_page_orientation, merge_tables, add_kv_ocr_confidence) are production-ready or experimental.
- Performance characteristics when processing large or multi-page documents.
- Compatibility with recent Textract API changes or new response schema versions.
Package facts
| License | Apache License Version 2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — boto3, marshmallow |
| Maintenance | dormant — 792 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,065,985/month — #3,327 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: amazon_textract_response_parser-1.0.3-py2.py3-none-any.whl
Keywords: amazon-textract-response-parser, trp, aws, amazon, textract, ocr, response, parser
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
amazon-textract-callerWrapper around Amazon Textract that handles…
permissive · top 5,000 on PyPI
amazon-textract-textractorTextractor wraps Amazon Textract APIs to…
permissive · top 5,000 on PyPI
textractExtracts text from documents in multiple…
permissive · top 15,000 on PyPI
pyocrPyOCR wraps multiple OCR engines (Tesseract,…
copyleft · top 15,000 on PyPI
types-aiobotocore-textractProvides type annotations and IDE autocomplete…
permissive · top 15,000 on PyPI
types-boto3-textractProvides type annotations for boto3's Textract…
permissive · top 15,000 on PyPI
tesserocrtesserocr wraps Tesseract's C++ OCR engine via…
permissive · top 15,000 on PyPI
layoutparserLayoutParser provides deep learning-based…
permissive · top 5,000 on PyPI
jsonsConverts Python objects (dataclasses, attrs…
permissive · top 5,000 on PyPI
mypy-boto3-textractProvides type annotations and IDE…
permissive · top 5,000 on PyPI