# Textract Response Parser to then leverage Comprehend CDK constructs You can use Textract-Amazon Augmented AI (A2I) response parser library to easily parser JSON returned by A2I human review workflow . Library parses JSON and provides programming language specific constructs to work with different parts of the document. ## Python Usage ``` # Call Amazon Textract with A2I HumanLoop Config and get JSON response # client = boto3.client('textract') # response = client.analyze_document(Document={...}, FeatureTypes=[...], HumanLoopConfig={...}) # Parse JSON response from Textract doc = Document(response) # Iterate over elements in the document for page in doc.pages: print("PAGE\n====================") print("Form (key/values)\n====================") for field in page.form.fields: k = "" v = "" if(field.key): k = field.key.text if(field.value): v = field.value.text print("Field: Key: {}, Value: {}".format(k,v)) #Get field by key key = "Policy Number:" print("\nGet field by key ({}):\n====================".format(key)) f = page.form.getFieldByKey(key) if(f): print("Field: Key: {}, Value: {}".format(f.key.text, f.value.text)) #Search field by key key = "Policy Number:" print("\nSearch field by key ({}):\n====================".format(key)) fields = page.form.searchFieldsByKey(key) for field in fields: print("Field: Key: {}, Value: {}".format(field.key, field.value)) ``` Example Output ``` ==================== Form (key/values) ==================== Field: Key: Phone Number:, Value: 555-0100 Get field by page ({'key': {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 63.59760284423828, 'Geometry': {'BoundingBox': {'Width': 0.16836532950401306, 'Height': 0.03139100223779678, 'Left': 0.02776719070971012, 'Top': 0.1963476836681366}, 'Polygon': [{'X': 0.02776719070971012, 'Y': 0.1963476836681366}, {'X': 0.19613252580165863, 'Y': 0.1963476836681366}, {'X': 0.19613252580165863, 'Y': 0.22773869335651398}, {'X': 0.02776719070971012, 'Y': 0.22773869335651398}]}, 'Id': 'dd8dbecf-73f1-49e2-bc9f-7169a133f6dd', 'Relationships': [{'Type': 'VALUE', 'Ids': ['a8acd770-2d5a-4799-9e0d-17a96b6da85a']}, {'Type': 'CHILD', 'Ids': ['b4dd773f-ddb7-407e-9dbc-cf623204e654', '63c1b36b-6b46-4391-b3a5-379247f448f8']}], 'EntityTypes': ['KEY']}, 'id': 'dd8dbecf-73f1-49e2-bc9f-7169a133f6dd', 'text': 'Phone Number:', 'content': [{'text': 'Phone', 'geometry': {'BoundingBox': {'Width': 0.06604675948619843, 'Height': 0.036048345267772675, 'Left': 0.029274573549628258, 'Top': 0.19063594937324524}, 'Polygon': [{'X': 0.029274573549628258, 'Y': 0.19063594937324524}, {'X': 0.09532133489847183, 'Y': 0.19063594937324524}, {'X': 0.09532133489847183, 'Y': 0.22668428719043732}, {'X': 0.029274573549628258, 'Y': 0.22668428719043732}]}, 'id': 'b4dd773f-ddb7-407e-9dbc-cf623204e654'}, {'text': 'Number:', 'geometry': {'BoundingBox': {'Width': 0.09247590601444244, 'Height': 0.034948017448186874, 'Left': 0.1015779972076416, 'Top': 0.19128166139125824}, 'Polygon': [{'X': 0.1015779972076416, 'Y': 0.19128166139125824}, {'X': 0.19405390322208405, 'Y': 0.19128166139125824}, {'X': 0.19405390322208405, 'Y': 0.2262296825647354}, {'X': 0.1015779972076416, 'Y': 0.2262296825647354}]}, 'id': '63c1b36b-6b46-4391-b3a5-379247f448f8'}]}, 'value': {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 63.59760284423828, 'Geometry': {'BoundingBox': {'Width': 0.09722070395946503, 'Height': 0.02516728639602661, 'Left': 0.20237421989440918, 'Top': 0.19808898866176605}, 'Polygon': [{'X': 0.20237421989440918, 'Y': 0.19808898866176605}, {'X': 0.2995949387550354, 'Y': 0.19808898866176605}, {'X': 0.2995949387550354, 'Y': 0.22325627505779266}, {'X': 0.20237421989440918, 'Y': 0.22325627505779266}]}, 'Id': 'a8acd770-2d5a-4799-9e0d-17a96b6da85a', 'Relationships': [{'Type': 'CHILD', 'Ids': ['6d3a0b8d-ce64-47d0-a8e8-3a4befb6d1e2']}], 'EntityTypes': ['VALUE']}, 'id': 'a8acd770-2d5a-4799-9e0d-17a96b6da85a', 'text': '555-0100', 'content': [{'text': '555-0100', 'geometry': {'BoundingBox': {'Width': 0.09652186185121536, 'Height': 0.03407157212495804, 'Left': 0.20061562955379486, 'Top': 0.1911606788635254}, 'Polygon': [{'X': 0.20061562955379486, 'Y': 0.1911606788635254}, {'X': 0.2971374988555908, 'Y': 0.1911606788635254}, {'X': 0.2971374988555908, 'Y': 0.22523224353790283}, {'X': 0.20061562955379486, 'Y': 0.22523224353790283}]}, 'id': '6d3a0b8d-ce64-47d0-a8e8-3a4befb6d1e2'}]}}): ==================== Field: Key: Home Address:, Value: 123 Any Street. Any Town. USA Get field by page ({'key': {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 65.030029296875, 'Geometry': {'BoundingBox': {'Width': 0.16203054785728455, 'Height': 0.03180292621254921, 'Left': 0.029164882376790047, 'Top': 0.2747862935066223}, 'Polygon': [{'X': 0.029164882376790047, 'Y': 0.2747862935066223}, {'X': 0.19119544327259064, 'Y': 0.2747862935066223}, {'X': 0.19119544327259064, 'Y': 0.3065892159938812}, {'X': 0.029164882376790047, 'Y': 0.3065892159938812}]}, 'Id': '03c0345c-f42d-4bea-864d-60a8d1e890fb', 'Relationships': [{'Type': 'VALUE', 'Ids': ['1059d4c4-dd84-4995-be8f-24c0e8b12a6a']}, {'Type': 'CHILD', 'Ids': ['c9d0f076-4489-4aa3-8790-fc2f5f011b75', '1263d49f-d745-463c-9cd6-e50cc4f041c4']}], 'EntityTypes': ['KEY']}, 'id': '03c0345c-f42d-4bea-864d-60a8d1e890fb', 'text': 'Home Address:', 'content': [{'text': 'Home', 'geometry': {'BoundingBox': {'Width': 0.06157437339425087, 'Height': 0.03566235676407814, 'Left': 0.02940143272280693, 'Top': 0.2697528600692749}, 'Polygon': [{'X': 0.02940143272280693, 'Y': 0.2697528600692749}, {'X': 0.0909758061170578, 'Y': 0.2697528600692749}, {'X': 0.0909758061170578, 'Y': 0.30541521310806274}, {'X': 0.02940143272280693, 'Y': 0.30541521310806274}]}, 'id': 'c9d0f076-4489-4aa3-8790-fc2f5f011b75'}, {'text': 'Address:', 'geometry': {'BoundingBox': {'Width': 0.09089267998933792, 'Height': 0.034272804856300354, 'Left': 0.09725941717624664, 'Top': 0.26987001299858093}, 'Polygon': [{'X': 0.09725941717624664, 'Y': 0.26987001299858093}, {'X': 0.18815210461616516, 'Y': 0.26987001299858093}, {'X': 0.18815210461616516, 'Y': 0.3041428029537201}, {'X': 0.09725941717624664, 'Y': 0.3041428029537201}]}, 'id': '1263d49f-d745-463c-9cd6-e50cc4f041c4'}]}, 'value': {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 65.030029296875, 'Geometry': {'BoundingBox': {'Width': 0.32020026445388794, 'Height': 0.026060447096824646, 'Left': 0.1938924342393875, 'Top': 0.2770303189754486}, 'Polygon': [{'X': 0.1938924342393875, 'Y': 0.2770303189754486}, {'X': 0.5140926837921143, 'Y': 0.2770303189754486}, {'X': 0.5140926837921143, 'Y': 0.30309075117111206}, {'X': 0.1938924342393875, 'Y': 0.30309075117111206}]}, 'Id': '1059d4c4-dd84-4995-be8f-24c0e8b12a6a', 'Relationships': [{'Type': 'CHILD', 'Ids': ['c86d0d6a-bb66-45ae-9f64-cce786a87f5e', '261d78c3-da83-48ff-ae0d-767d042e27cd', 'e1335e11-d8b5-4eac-a330-0e3ce583d598', '60f9dba7-817a-4940-a1c4-e4f91ed9df83', '3b6b440c-172d-4fb0-9306-f5676934f1e0', 'dd3d86a3-2b09-4532-8714-21a6634bf7c4']}], 'EntityTypes': ['VALUE']}, 'id': '1059d4c4-dd84-4995-be8f-24c0e8b12a6a', 'text': '123 Any Street. Any Town. USA', 'content': [{'text': '123', 'geometry': {'BoundingBox': {'Width': 0.03711886331439018, 'Height': 0.03453168272972107, 'Left': 0.19541588425636292, 'Top': 0.2700358033180237}, 'Polygon': [{'X': 0.19541588425636292, 'Y': 0.2700358033180237}, {'X': 0.2325347512960434, 'Y': 0.2700358033180237}, {'X': 0.2325347512960434, 'Y': 0.30456748604774475}, {'X': 0.19541588425636292, 'Y': 0.30456748604774475}]}, 'id': 'c86d0d6a-bb66-45ae-9f64-cce786a87f5e'}, {'text': 'Any', 'geometry': {'BoundingBox': {'Width': 0.03809557482600212, 'Height': 0.033582814037799835, 'Left': 0.23934930562973022, 'Top': 0.2701190710067749}, 'Polygon': [{'X': 0.23934930562973022, 'Y': 0.2701190710067749}, {'X': 0.27744486927986145, 'Y': 0.2701190710067749}, {'X': 0.27744486927986145, 'Y': 0.30370190739631653}, {'X': 0.23934930562973022, 'Y': 0.30370190739631653}]}, 'id': '261d78c3-da83-48ff-ae0d-767d042e27cd'}, {'text': 'Street.', 'geometry': {'BoundingBox': {'Width': 0.06751600652933121, 'Height': 0.037430375814437866, 'Left': 0.28329533338546753, 'Top': 0.2694692611694336}, 'Polygon': [{'X': 0.28329533338546753, 'Y': 0.2694692611694336}, {'X': 0.35081133246421814, 'Y': 0.2694692611694336}, {'X': 0.35081133246421814, 'Y': 0.30689963698387146}, {'X': 0.28329533338546753, 'Y': 0.30689963698387146}]}, 'id': 'e1335e11-d8b5-4eac-a330-0e3ce583d598'}, {'text': 'Any', 'geometry': {'BoundingBox': {'Width': 0.039666011929512024, 'Height': 0.03783031925559044, 'Left': 0.35845300555229187, 'Top': 0.26757919788360596}, 'Polygon': [{'X': 0.35845300555229187, 'Y': 0.26757919788360596}, {'X': 0.3981190323829651, 'Y': 0.26757919788360596}, {'X': 0.3981190323829651, 'Y': 0.3054095208644867}, {'X': 0.35845300555229187, 'Y': 0.3054095208644867}]}, 'id': '60f9dba7-817a-4940-a1c4-e4f91ed9df83'}, {'text': 'Town.', 'geometry': {'BoundingBox': {'Width': 0.06211653724312782, 'Height': 0.03377317637205124, 'Left': 0.4035578966140747, 'Top': 0.2707397937774658}, 'Polygon': [{'X': 0.4035578966140747, 'Y': 0.2707397937774658}, {'X': 0.4656744599342346, 'Y': 0.2707397937774658}, {'X': 0.4656744599342346, 'Y': 0.30451294779777527}, {'X': 0.4035578966140747, 'Y': 0.30451294779777527}]}, 'id': '3b6b440c-172d-4fb0-9306-f5676934f1e0'}, {'text': 'USA', 'geometry': {'BoundingBox': {'Width': 0.0430777333676815, 'Height': 0.036002177745103836, 'Left': 0.4719868302345276, 'Top': 0.2684972286224365}, 'Polygon': [{'X': 0.4719868302345276, 'Y': 0.2684972286224365}, {'X': 0.515064537525177, 'Y': 0.2684972286224365}, {'X': 0.515064537525177, 'Y': 0.30449938774108887}, {'X': 0.4719868302345276, 'Y': 0.30449938774108887}]}, 'id': 'dd3d86a3-2b09-4532-8714-21a6634bf7c4'}]}}): ==================== Field: Key: Full Name:, Value: Jane Doe Get field by page ({'key': {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 71.14427947998047, 'Geometry': {'BoundingBox': {'Width': 0.11259862035512924, 'Height': 0.030633898451924324, 'Left': 0.0298884566873312, 'Top': 0.11796300113201141}, 'Polygon': [{'X': 0.0298884566873312, 'Y': 0.11796300113201141}, {'X': 0.1424870789051056, 'Y': 0.11796300113201141}, {'X': 0.1424870789051056, 'Y': 0.1485968977212906}, {'X': 0.0298884566873312, 'Y': 0.1485968977212906}]}, 'Id': '100c9244-9c74-4166-82b5-1e9890cf455d', 'Relationships': [{'Type': 'VALUE', 'Ids': ['3f728c36-56f2-487c-a3e2-3cafe49f7da9']}, {'Type': 'CHILD', 'Ids': ['15c0cdb2-e75d-4003-b5d3-6a686001a701', '52821638-ea10-4309-9c9b-08007b95e63c']}], 'EntityTypes': ['KEY']}, 'id': '100c9244-9c74-4166-82b5-1e9890cf455d', 'text': 'Full Name:', 'content': [{'text': 'Full', 'geometry': {'BoundingBox': {'Width': 0.03760237246751785, 'Height': 0.031485531479120255, 'Left': 0.028746025636792183, 'Top': 0.1136014312505722}, 'Polygon': [{'X': 0.028746025636792183, 'Y': 0.1136014312505722}, {'X': 0.06634839624166489, 'Y': 0.1136014312505722}, {'X': 0.06634839624166489, 'Y': 0.14508697390556335}, {'X': 0.028746025636792183, 'Y': 0.14508697390556335}]}, 'id': '15c0cdb2-e75d-4003-b5d3-6a686001a701'}, {'text': 'Name:', 'geometry': {'BoundingBox': {'Width': 0.06856495141983032, 'Height': 0.03152376785874367, 'Left': 0.07292687147855759, 'Top': 0.11458774656057358}, 'Polygon': [{'X': 0.07292687147855759, 'Y': 0.11458774656057358}, {'X': 0.1414918154478073, 'Y': 0.11458774656057358}, {'X': 0.1414918154478073, 'Y': 0.14611151814460754}, {'X': 0.07292687147855759, 'Y': 0.14611151814460754}]}, 'id': '52821638-ea10-4309-9c9b-08007b95e63c'}]}, 'value': {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 71.14427947998047, 'Geometry': {'BoundingBox': {'Width': 0.08989597856998444, 'Height': 0.021258536726236343, 'Left': 0.15263603627681732, 'Top': 0.12021855264902115}, 'Polygon': [{'X': 0.15263603627681732, 'Y': 0.12021855264902115}, {'X': 0.24253201484680176, 'Y': 0.12021855264902115}, {'X': 0.24253201484680176, 'Y': 0.1414770931005478}, {'X': 0.15263603627681732, 'Y': 0.1414770931005478}]}, 'Id': '3f728c36-56f2-487c-a3e2-3cafe49f7da9', 'Relationships': [{'Type': 'CHILD', 'Ids': ['acc5b5fa-8e18-408f-ae6e-bf3336f9011e', 'b1998385-b2df-4099-a2a1-1942b5db099e']}], 'EntityTypes': ['VALUE']}, 'id': '3f728c36-56f2-487c-a3e2-3cafe49f7da9', 'text': 'Jane Doe', 'content': [{'text': 'Jane', 'geometry': {'BoundingBox': {'Width': 0.04376714304089546, 'Height': 0.03144075721502304, 'Left': 0.14814163744449615, 'Top': 0.11421803385019302}, 'Polygon': [{'X': 0.14814163744449615, 'Y': 0.11421803385019302}, {'X': 0.19190877676010132, 'Y': 0.11421803385019302}, {'X': 0.19190877676010132, 'Y': 0.14565879106521606}, {'X': 0.14814163744449615, 'Y': 0.14565879106521606}]}, 'id': 'acc5b5fa-8e18-408f-ae6e-bf3336f9011e'}, {'text': 'Doe', 'geometry': {'BoundingBox': {'Width': 0.04023061692714691, 'Height': 0.03364269435405731, 'Left': 0.199162557721138, 'Top': 0.11213930696249008}, 'Polygon': [{'X': 0.199162557721138, 'Y': 0.11213930696249008}, {'X': 0.2393931746482849, 'Y': 0.11213930696249008}, {'X': 0.2393931746482849, 'Y': 0.145782008767128}, {'X': 0.199162557721138, 'Y': 0.145782008767128}]}, 'id': 'b1998385-b2df-4099-a2a1-1942b5db099e'}]}}): ==================== Field: Key: Mailing Address:, Value: same as home address Get field by page ({'key': {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 61.29184341430664, 'Geometry': {'BoundingBox': {'Width': 0.17466463148593903, 'Height': 0.03513805568218231, 'Left': 0.03024386055767536, 'Top': 0.35338595509529114}, 'Polygon': [{'X': 0.03024386055767536, 'Y': 0.35338595509529114}, {'X': 0.20490849018096924, 'Y': 0.35338595509529114}, {'X': 0.20490849018096924, 'Y': 0.38852402567863464}, {'X': 0.03024386055767536, 'Y': 0.38852402567863464}]}, 'Id': 'b7684bc3-cec7-4f4e-a2bc-ac0866094ac6', 'Relationships': [{'Type': 'VALUE', 'Ids': ['c327f8af-fd9f-47d8-bf47-b8fe34719fd3']}, {'Type': 'CHILD', 'Ids': ['13cfdb19-c9d2-42e2-8046-5f917f9d1818', '68c73643-715a-425f-b82b-19cb66df9557']}], 'EntityTypes': ['KEY']}, 'id': 'b7684bc3-cec7-4f4e-a2bc-ac0866094ac6', 'text': 'Mailing Address:', 'content': [{'text': 'Mailing', 'geometry': {'BoundingBox': {'Width': 0.0780109241604805, 'Height': 0.0394306443631649, 'Left': 0.02931326813995838, 'Top': 0.3479834496974945}, 'Polygon': [{'X': 0.02931326813995838, 'Y': 0.3479834496974945}, {'X': 0.10732419788837433, 'Y': 0.3479834496974945}, {'X': 0.10732419788837433, 'Y': 0.3874140977859497}, {'X': 0.02931326813995838, 'Y': 0.3874140977859497}]}, 'id': '13cfdb19-c9d2-42e2-8046-5f917f9d1818'}, {'text': 'Address:', 'geometry': {'BoundingBox': {'Width': 0.09546246379613876, 'Height': 0.03629772365093231, 'Left': 0.11462893337011337, 'Top': 0.34784042835235596}, 'Polygon': [{'X': 0.11462893337011337, 'Y': 0.34784042835235596}, {'X': 0.21009139716625214, 'Y': 0.34784042835235596}, {'X': 0.21009139716625214, 'Y': 0.3841381371021271}, {'X': 0.11462893337011337, 'Y': 0.3841381371021271}]}, 'id': '68c73643-715a-425f-b82b-19cb66df9557'}]}, 'value': {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 61.29184341430664, 'Geometry': {'BoundingBox': {'Width': 0.2409568428993225, 'Height': 0.025999346747994423, 'Left': 0.21125726401805878, 'Top': 0.3559841811656952}, 'Polygon': [{'X': 0.21125726401805878, 'Y': 0.3559841811656952}, {'X': 0.4522141218185425, 'Y': 0.3559841811656952}, {'X': 0.4522141218185425, 'Y': 0.38198351860046387}, {'X': 0.21125726401805878, 'Y': 0.38198351860046387}]}, 'Id': 'c327f8af-fd9f-47d8-bf47-b8fe34719fd3', 'Relationships': [{'Type': 'CHILD', 'Ids': ['633eab1f-bf59-4d65-b6d8-ea19063a79d2', 'a3bfe68d-d04e-4726-a617-a9133eaf4d4c', 'ae9d2ee5-3c49-4e22-b5f1-e0026d2a89bd', 'd47560af-a6b4-44ee-ab15-9ff70b0bf073']}], 'EntityTypes': ['VALUE']}, 'id': 'c327f8af-fd9f-47d8-bf47-b8fe34719fd3', 'text': 'same as home address', 'content': [{'text': 'same', 'geometry': {'BoundingBox': {'Width': 0.05386832728981972, 'Height': 0.037169020622968674, 'Left': 0.21596916019916534, 'Top': 0.34663155674934387}, 'Polygon': [{'X': 0.21596916019916534, 'Y': 0.34663155674934387}, {'X': 0.26983749866485596, 'Y': 0.34663155674934387}, {'X': 0.26983749866485596, 'Y': 0.38380059599876404}, {'X': 0.21596916019916534, 'Y': 0.38380059599876404}]}, 'id': '633eab1f-bf59-4d65-b6d8-ea19063a79d2'}, {'text': 'as', 'geometry': {'BoundingBox': {'Width': 0.021625958383083344, 'Height': 0.03536900505423546, 'Left': 0.2770702540874481, 'Top': 0.3487294614315033}, 'Polygon': [{'X': 0.2770702540874481, 'Y': 0.3487294614315033}, {'X': 0.29869621992111206, 'Y': 0.3487294614315033}, {'X': 0.29869621992111206, 'Y': 0.38409844040870667}, {'X': 0.2770702540874481, 'Y': 0.38409844040870667}]}, 'id': 'a3bfe68d-d04e-4726-a617-a9133eaf4d4c'}, {'text': 'home', 'geometry': {'BoundingBox': {'Width': 0.05847536772489548, 'Height': 0.03493012860417366, 'Left': 0.30445289611816406, 'Top': 0.3482665717601776}, 'Polygon': [{'X': 0.30445289611816406, 'Y': 0.3482665717601776}, {'X': 0.36292827129364014, 'Y': 0.3482665717601776}, {'X': 0.36292827129364014, 'Y': 0.38319671154022217}, {'X': 0.30445289611816406, 'Y': 0.38319671154022217}]}, 'id': 'ae9d2ee5-3c49-4e22-b5f1-e0026d2a89bd'}, {'text': 'address', 'geometry': {'BoundingBox': {'Width': 0.07848889380693436, 'Height': 0.03136633336544037, 'Left': 0.3697330355644226, 'Top': 0.35001784563064575}, 'Polygon': [{'X': 0.3697330355644226, 'Y': 0.35001784563064575}, {'X': 0.44822192192077637, 'Y': 0.35001784563064575}, {'X': 0.44822192192077637, 'Y': 0.3813841640949249}, {'X': 0.3697330355644226, 'Y': 0.3813841640949249}]}, 'id': 'd47560af-a6b4-44ee-ab15-9ff70b0bf073'}]}}): ==================== Get field by key (Home Address:): ==================== Field: Key: Home Address:, Value: 123 Any Street. Any Town. USA Search field by key (Home Address:): ==================== Field:Value: {'block': {'BlockType': 'KEY_VALUE_SET', 'Confidence': 65.030029296875, 'Geometry': {'BoundingBox': {'Width': 0.32020026445388794, 'Height': 0.026060447096824646, 'Left': 0.1938924342393875, 'Top': 0.2770303189754486}, 'Polygon': [{'X': 0.1938924342393875, 'Y': 0.2770303189754486}, {'X': 0.5140926837921143, 'Y': 0.2770303189754486}, {'X': 0.5140926837921143, 'Y': 0.30309075117111206}, {'X': 0.1938924342393875, 'Y': 0.30309075117111206}]}, 'Id': '1059d4c4-dd84-4995-be8f-24c0e8b12a6a', 'Relationships': [{'Type': 'CHILD', 'Ids': ['c86d0d6a-bb66-45ae-9f64-cce786a87f5e', '261d78c3-da83-48ff-ae0d-767d042e27cd', 'e1335e11-d8b5-4eac-a330-0e3ce583d598', '60f9dba7-817a-4940-a1c4-e4f91ed9df83', '3b6b440c-172d-4fb0-9306-f5676934f1e0', 'dd3d86a3-2b09-4532-8714-21a6634bf7c4']}], 'EntityTypes': ['VALUE']}, 'id': '1059d4c4-dd84-4995-be8f-24c0e8b12a6a', 'text': '123 Any Street. Any Town. USA', 'content': [{'text': '123', 'geometry': {'BoundingBox': {'Width': 0.03711886331439018, 'Height': 0.03453168272972107, 'Left': 0.19541588425636292, 'Top': 0.2700358033180237}, 'Polygon': [{'X': 0.19541588425636292, 'Y': 0.2700358033180237}, {'X': 0.2325347512960434, 'Y': 0.2700358033180237}, {'X': 0.2325347512960434, 'Y': 0.30456748604774475}, {'X': 0.19541588425636292, 'Y': 0.30456748604774475}]}, 'id': 'c86d0d6a-bb66-45ae-9f64-cce786a87f5e'}, {'text': 'Any', 'geometry': {'BoundingBox': {'Width': 0.03809557482600212, 'Height': 0.033582814037799835, 'Left': 0.23934930562973022, 'Top': 0.2701190710067749}, 'Polygon': [{'X': 0.23934930562973022, 'Y': 0.2701190710067749}, {'X': 0.27744486927986145, 'Y': 0.2701190710067749}, {'X': 0.27744486927986145, 'Y': 0.30370190739631653}, {'X': 0.23934930562973022, 'Y': 0.30370190739631653}]}, 'id': '261d78c3-da83-48ff-ae0d-767d042e27cd'}, {'text': 'Street.', 'geometry': {'BoundingBox': {'Width': 0.06751600652933121, 'Height': 0.037430375814437866, 'Left': 0.28329533338546753, 'Top': 0.2694692611694336}, 'Polygon': [{'X': 0.28329533338546753, 'Y': 0.2694692611694336}, {'X': 0.35081133246421814, 'Y': 0.2694692611694336}, {'X': 0.35081133246421814, 'Y': 0.30689963698387146}, {'X': 0.28329533338546753, 'Y': 0.30689963698387146}]}, 'id': 'e1335e11-d8b5-4eac-a330-0e3ce583d598'}, {'text': 'Any', 'geometry': {'BoundingBox': {'Width': 0.039666011929512024, 'Height': 0.03783031925559044, 'Left': 0.35845300555229187, 'Top': 0.26757919788360596}, 'Polygon': [{'X': 0.35845300555229187, 'Y': 0.26757919788360596}, {'X': 0.3981190323829651, 'Y': 0.26757919788360596}, {'X': 0.3981190323829651, 'Y': 0.3054095208644867}, {'X': 0.35845300555229187, 'Y': 0.3054095208644867}]}, 'id': '60f9dba7-817a-4940-a1c4-e4f91ed9df83'}, {'text': 'Town.', 'geometry': {'BoundingBox': {'Width': 0.06211653724312782, 'Height': 0.03377317637205124, 'Left': 0.4035578966140747, 'Top': 0.2707397937774658}, 'Polygon': [{'X': 0.4035578966140747, 'Y': 0.2707397937774658}, {'X': 0.4656744599342346, 'Y': 0.2707397937774658}, {'X': 0.4656744599342346, 'Y': 0.30451294779777527}, {'X': 0.4035578966140747, 'Y': 0.30451294779777527}]}, 'id': '3b6b440c-172d-4fb0-9306-f5676934f1e0'}, {'text': 'USA', 'geometry': {'BoundingBox': {'Width': 0.0430777333676815, 'Height': 0.036002177745103836, 'Left': 0.4719868302345276, 'Top': 0.2684972286224365}, 'Polygon': [{'X': 0.4719868302345276, 'Y': 0.2684972286224365}, {'X': 0.515064537525177, 'Y': 0.2684972286224365}, {'X': 0.515064537525177, 'Y': 0.30449938774108887}, {'X': 0.4719868302345276, 'Y': 0.30449938774108887}]}, 'id': 'dd3d86a3-2b09-4532-8714-21a6634bf7c4'}]}, ----- Key: [{'text': 'Home', 'geometry': {'BoundingBox': {'Width': 0.06157437339425087, 'Height': 0.03566235676407814, 'Left': 0.02940143272280693, 'Top': 0.2697528600692749}, 'Polygon': [{'X': 0.02940143272280693, 'Y': 0.2697528600692749}, {'X': 0.0909758061170578, 'Y': 0.2697528600692749}, {'X': 0.0909758061170578, 'Y': 0.30541521310806274}, {'X': 0.02940143272280693, 'Y': 0.30541521310806274}]}, 'id': 'c9d0f076-4489-4aa3-8790-fc2f5f011b75'}, {'text': 'Address:', 'geometry': {'BoundingBox': {'Width': 0.09089267998933792, 'Height': 0.034272804856300354, 'Left': 0.09725941717624664, 'Top': 0.26987001299858093}, 'Polygon': [{'X': 0.09725941717624664, 'Y': 0.26987001299858093}, {'X': 0.18815210461616516, 'Y': 0.26987001299858093}, {'X': 0.18815210461616516, 'Y': 0.3041428029537201}, {'X': 0.09725941717624664, 'Y': 0.3041428029537201}]}, 'id': '1263d49f-d745-463c-9cd6-e50cc4f041c4'}] Process finished with exit code 0 ``` ## Test - Download [code](.) on your local machine. - Run "python3 mappingtest.py" - You should see output using the sample JSON response file included in the source. ## Other Resources ## License Summary This sample code is made available under the MIT-0 license. See the LICENSE file.