OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Json_decode return empty

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

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #25040


    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:\/\/dev.crm.local.info\/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 http://jsonviewer.stack.hu/

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


    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)

The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No