Convert Google Vision API response to JSON

前端 未结 2 1084
遇见更好的自我
遇见更好的自我 2021-01-12 07:54

Task:

  • Convert Google Vision API response to JSON

Problem:

  • The return value from the API call is
相关标签:
2条回答
  • 2021-01-12 08:18

    That library returns plain protobuf objects, which can be serialized to JSON using:

    from google.protobuf.json_format import MessageToJson
    serialized = MessageToJson(original)
    

    This worked for me.

    0 讨论(0)
  • 2021-01-12 08:26

    Found solution. It can not be converted to JSON but can be accessed like this:

    print(logos[0].bounding_poly.vertices[0].x)
    
    0 讨论(0)
提交回复
热议问题