--- id: amazon-textract-response-parser version: "1.0.3" license: Apache License Version 2.0 license_treatment: permissive maintenance: dormant --- # amazon-textract-response-parser — Easily parse JSON returned by Amazon Textract. License: permissive · Maintenance: dormant · Downloads: 2.1M/mo ## 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 above — 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 pip install amazon-textract-response-parser uv add amazon-textract-response-parser poetry add amazon-textract-response-parser ## Installing 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_current - Install friction: low - Maintenance: dormant - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags textract response parser, parse textract json, amazon textract ocr, textract document processing, ocr response parsing, textract json to objects, textract pipeline components, aws-textract, ocr-parsing, document-processing [View on SkillFed](https://skillfed.io/packages/amazon-textract-response-parser) · [View on PyPI](https://pypi.org/project/amazon-textract-response-parser/)