0

I have an post request API that returns stdClass object as response. I'm using firebase cloud function in Javascript and I tried to use response.json() but it gets error "Converting circular structure to JSON" so I need to convert or do something on stdClass object to array or json. Is there any solution for this?

Pood
  • 41
  • 3
  • 2
    Can you show the output? – lucas Mar 09 '20 at 10:59
  • I can't see the ouput cuz if I try .json() , it gets an error and if i just send response i get {"size":0,"timeout":0} – Pood Mar 09 '20 at 11:03
  • but from the documentation for this API output must be something like this.. – Pood Mar 09 '20 at 11:04
  • [company] => stdClass Object( [testrentcar] => stdClass Object ( [trip] => Array ( [0] => stdClass Object ( [code] => 2 ) – Pood Mar 09 '20 at 11:06
  • Check this answer https://stackoverflow.com/questions/16062824/convert-object-of-class-stdclass-to-json-object/16063282 – ajorquera Mar 09 '20 at 12:42

0 Answers0