Forums OroCRM OroCRM – Programming Questions Json_decode return empty

This topic contains 1 reply, has 2 voices, and was last updated by  nino.fischer 2 years, 6 months ago.

  • Creator
  • #22422


    Hi guys !

    I am calling search rest API and i got this result

    {“records_count”:1,”count”:1,”data”:[{“entity_name”:”OroCRM\\Bundle\\ContactBundle\\Entity\\Contact”,”record_id”:2,”record_string”:”Hung Luu”,”record_url”:”http:\/\/\/contact\/view\/2″}]}

    when i call json_decode it return nothing , can you please let me know what is going on ? even it is a valid JSON

Viewing 1 replies (of 1 total)
  • Author
  • #22423


    Hi Hung!

    I encountered the same issue as you did.
    In my case, i wanted to show a list of all leads of mine.
    In php i used the Guzzle-Client.

    Maybe my code will help you answering your question:

    //the Request is an instance of the Guzzle-Client, with set options (connection-parameters)
    $response = $request->send();
    $responseSTR = trim($response->getBody(),"[]");

    As you can see, I trimmed the response-body by these brazelets.
    For me this did all the magic.

    I hope I could help you in some way.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.