1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    163
    Answers
    5
    Vote Rating
    2
    rafaelrp is on a distinguished road

      0  

    Default Answered: Problem with Json Decode in PHP

    Answered: Problem with Json Decode in PHP


    Hello!

    I'm having a problem with json decode in my PHP server.. PHP5, linux

    param:
    Code:
    data:{"cliId":""}
    php decoded:
    Code:
    data:{\"cliId\":\"\"}
    PHP put this "\" in the json and i can't get the array...

    php code
    Code:
    $arrayResponse = json_decode($_REQUEST['data']);


    Thanks!

  2. I solved this problem so:
    Code:
    list($files) = $db->sql_fetchrow($db->sql_query("SELECT files FROM *** WHERE id = ".$id));
    // echo json from php to extjs
    echo str_replace("\\", "", trim(html_entity_decode($files), "\""));

  3. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,114
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Hmm strange, you format half way


    Code:
    "data": {"cliId": ""}

  4. #3
    Sencha User
    Join Date
    Jan 2011
    Location
    Russia, Moskow
    Posts
    2
    Answers
    1
    Vote Rating
    0
    semushin is on a distinguished road

      0  

    Default


    I solved this problem so:
    Code:
    list($files) = $db->sql_fetchrow($db->sql_query("SELECT files FROM *** WHERE id = ".$id));
    // echo json from php to extjs
    echo str_replace("\\", "", trim(html_entity_decode($files), "\""));

  5. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    163
    Answers
    5
    Vote Rating
    2
    rafaelrp is on a distinguished road

      0  

    Default


    I solved this problem using this functions
    Code:
    $jsonEncoded = stripslashes($_REQUEST['data']);
    $arrayResponse = json_decode($jsonEncoded);
    But i don't think is the best way...

    The best way is the php read the json without the "\"

    Thanks!

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi