I am using Google Cloud Document AI's Invoice Parser. API response is google.cloud.documentai_v1.types.Document object. I tried to write below approaches for converting it to JSON but nothing works:
- json.dumps() but it gives JSONDecodeError
- google.cloud.documentai_v1.Document.to_json()