Structured JSON and citations
Ask for export=json to publish document.json, a StructuredDocument. It describes every source page and the content found on it, so each piece of text can be traced to a page and a region.
{ "schema_version": "1.0", "document_id": "a~d17", "page_count": 1, "pages": [ { "page_number": 1, "width": 612, "height": 792, "unit": "pt", "blocks": [ { "id": "p1-b1", "type": "text", "text": "Invoice total: $42.00", "bbox": { "left": 0.1, "top": 0.1, "right": 0.8, "bottom": 0.2 }, "confidence": null } ] } ]}pages holds one entry per source page, in order, numbered from 1 to page_count with no gaps. Each page records its width and height with a unit: pt (PDF points) for PDFs and px (pixels) for images. Dimensions describe the page as displayed, after rotation.
Blocks
Section titled “Blocks”Each page has blocks in reading order. Block IDs are unique within the document, so id is a stable citation target.
| Field | Meaning |
|---|---|
type |
text, table, figure or formula |
text |
The block’s text; for tables and figures, a readable rendering or caption |
bbox |
Where the block sits on the page |
confidence |
A score from 0 to 1, or null when no score is available. Sonic Docs never invents one. |
table |
Present on table blocks |
asset |
On figure blocks, the figure’s PNG filename in the same result manifest |
Bounding boxes and citations
Section titled “Bounding boxes and citations”bbox uses normalized coordinates with the origin at the top left of the displayed page: left and right are fractions of the width, top and bottom fractions of the height, with 0 <= left < right <= 1 and 0 <= top < bottom <= 1.
To highlight a block on a rendered page, multiply by the page size you draw at:
const x = bbox.left * renderedWidth;const y = bbox.top * renderedHeight;const w = (bbox.right - bbox.left) * renderedWidth;const h = (bbox.bottom - bbox.top) * renderedHeight;A citation is the pair of page_number and block id, optionally with the bbox. Because pages and IDs are stable for a document’s result, you can store citations alongside extracted text and show the source region later.
Tables
Section titled “Tables”A table block has rows, columns and cells. Cells use zero-based row and column positions, positive row_span and column_span, the cell text and an is_header flag. Cells stay inside the table and never overlap. Merged cells are expressed with spans, so rebuild a grid by placing each cell at its position and spanning it across rows and columns.
Figures and formulas
Section titled “Figures and formulas”A figure block names its image in asset; the PNG is listed in the same manifest. Regions that cannot be interpreted reliably, including charts and formulas whose structure is uncertain, are kept as figures rather than reported as recognized content.
Compatibility
Section titled “Compatibility”schema_version is "1.0". Within version 1, required fields keep their meaning; new optional fields may appear, so ignore fields you do not recognize.