Parse escaped JSON in PHP

后端 未结 1 1266
再見小時候
再見小時候 2021-01-15 01:11

I\'m a newb in PHP world and I\'ve problems parsing JSON in PHP. I want to POST data to PHP script with my Java client using Apache HttpClient 4.x and Gso

1条回答
  •  天命终不由人
    2021-01-15 01:58

    try with stripslashes()

    $string = stripslashes('[{\"Knt_KntWatchId\":\"15\",\"type\":\"INSERT\",\"Knt_Nazwa1\":\"a\"}]');
    print_r(json_decode($string));
    

    so il will be

    $json = json_decode(stripslashes($data), true);
    

    0 讨论(0)
提交回复
热议问题