Extraction results
Extraction produces a structured JSON representation of a document: its text and layout,
reading order, per-page detail, and statistics. This page is a field reference for the
extraction result.json, keyed to a trimmed example.
Extraction results are written to extraction/<n>/result.json, where
<n> is the document index. The sections that appear depend on the
granularity you configured (see Granularity).
For the surrounding file layout, see Output location and file structure.
Top-level structure
An extraction result.json has these top-level members:
Member |
Description |
|---|---|
|
Information about the source document and this extraction segment. |
|
Document-level representations, optional summary and description, and statistics. |
|
Per-page detail (appears with |
|
Layout elements such as titles, paragraphs, and tables (appears
with |
|
Line-level text (appears with |
|
Word-level text (appears with |
The following example is trimmed and uses placeholder content.
{ "metadata": { "asset_id": "0", "logical_subdocument_id": "0", "semantic_modality": "DOCUMENT", "s3_bucket": "amzn-s3-demo-bucket", "s3_key": "invoice.pdf", "number_of_pages": 5, "start_page_index": 0, "end_page_index": 4, "file_type": "PDF" }, "document": { "representation": { "text": "Example Company\n\nInvoice Number #000009 ...", "markdown": "# Example Company\n\n| | |\n|--|--|\n| Invoice Number | #000009 | ...", "html": "<html><body><h1>Example Company</h1> ..." }, "description": "This is an invoice about goods sold", "summary": "This document is an invoice from one company to another, dated ... . The invoice lists the products sold and their prices. ...", "statistics": { "element_count": 42, "table_count": 13, "figure_count": 0, "word_count": 1637, "line_count": 1085, "hyperlink_count": 9 } }, "pages": [ "... (one entry per page)" ], "elements": [ "... (one entry per layout element)" ], "text_lines": [ "... (one entry per line)" ], "text_words": [ "... (one entry per word)" ] }
metadata
Field |
Description |
|---|---|
|
Identifier of the input file (0 for a single input). |
|
Identifier of the logical document within the input, after any splitting. |
|
The modality of the content, for example
|
|
Location of the source document in Amazon S3. |
|
Number of pages in this segment. |
|
Zero-based page range of this segment within the input file. |
|
Input file type, for example |
document
The document member holds document-level output:
Field |
Description |
|---|---|
|
The whole document rendered as |
|
A single sentence naming the document type and its subject, for example "This is an invoice about goods sold." Present only when summarization is enabled. See Document summarization and figure captioning. |
|
A natural-language summary, present only when summarization is enabled. See Document summarization and figure captioning. |
|
Counts for the document — |
With PAGE granularity but no DOCUMENT granularity, the
document member still exists but contains only
statistics.
pages
Each entry in pages describes one page:
Field |
Description |
|---|---|
|
Unique page identifier. |
|
Zero-based page number. |
|
The page rendered as |
|
Per-page counts, same shape as the document statistics. |
|
Page image assets: |
elements
Each entry in elements is a layout element in reading order:
Field |
Description |
|---|---|
|
|
|
For |
|
Unique element identifier. |
|
The element's position in the document reading order. |
|
The pages the element spans. |
|
The element rendered as |
|
A list of |
A TABLE element adds a csv representation, a
csv_s3_uri pointing at the exported CSV, and title,
headers, and footers.
{ "type": "TEXT", "sub_type": "TITLE", "id": "fc47ab5a690644bd92aa5ad594aaada1", "reading_order": 0, "page_indices": [0], "representation": { "text": "Example Company", "markdown": "# Example Company", "html": "<h1>Example Company</h1>" }, "locations": [ { "page_index": 0, "bounding_box": { "left": 0.0519, "top": 0.1980, "width": 0.2051, "height": 0.0405 } } ] }
text_lines and text_words
text_lines and text_words give line- and word-level text
with recognition confidence:
Field |
Description |
|---|---|
|
Unique line or word identifier. |
|
The recognized text. |
|
Recognition confidence, from 0 to 1. Other Amazon Textract
APIs, such as |
|
Position in the reading order. |
|
The page the line or word is on. |
|
A list of |
A word additionally has a line_id linking it to its line.
Bounding boxes
Every bounding_box is expressed as ratios of the page width and height,
from 0 to 1:
Field |
Description |
|---|---|
|
Distance from the left edge, as a fraction of page width. |
|
Distance from the top edge, as a fraction of page height. |
|
Width, as a fraction of page width. |
|
Height, as a fraction of page height. |
To convert to pixels, multiply by the page's pixel dimensions (for example
rectified_image_width_pixels and
rectified_image_height_pixels from asset_metadata).
Granularity
Granularity.Types in the project's extraction configuration controls
which sections appear in the result:
Granularity type |
Section produced |
|---|---|
|
|
|
|
|
|
|
|
|
|
Next steps
-
Configure which text formats appear in
representationin Output formats for LLM and RAG workflows. -
Add a summary and figure captions in Document summarization and figure captioning.