Using a general form parser, i want to fetch the entities and append those to the document object. (for a general form parser-- there are no properties called "entities", so need to create one)
though i am using to_json() to convert the document object to json object, similarly, is there any function to reverse this operation like converting the json object to the document object.
doc_json=documentai.Document.to_json(result.document)
my_image = json.loads(doc_json)
my_dict={}
my_dict['textAnchor']=result.document.pages[0].form_fields[0].field_value.text_anchor //creating entities
my_list.append(my_dict)
my_image['entities']=my_list
toDoc=json.dumps(my_image)
Getting an error "TypeError: Object of type TextAnchor is not JSON serializable"
I did try the following
- added to json for the result json but still its not making serialisable