G
G
genesis11112020-05-14 15:05:46
PHP
genesis1111, 2020-05-14 15:05:46

How to parse google api response?

Hello!
I am using google api (vision). Everything works, I get a response like this:

object(Google\Cloud\Vision\Annotation)#33 (12) { ["info":"Google\Cloud\Vision\Annotation":private]=> array(1) { ["webDetection"]=> array(5) { ["webEntities"]=> array(10) { [0]=> array(3) { ["entityId"]=> string(8) "/m/0kpmf" ["score"]=> float(0.5972826) ["description"]=> string(9) "Dog breed" }

and then a bunch of code
tried to decode as json_decode in php - it was not possible to
build a bicycle - it also failed.

Tell me how to get the result "Dog breed" correctly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2020-05-14
@genezis1111

Judging by the above piece, you have an object of the Google\Cloud\Vision\Annotation class.
So you are using some kind of lib.
So you need to look at the documentation for this lib, there will be an answer to your question.
like this class

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question