开发者

Error in json_decode

开发者 https://www.devze.com 2023-03-24 02:15 出处:网络
I have the following json, I\'m sending through AJAX, but in the server side the json_decode returning an empty array. I\'m sending different values as well, and in that case it\'s working fine. I che

I have the following json, I'm sending through AJAX, but in the server side the json_decode returning an empty array. I'm sending different values as well, and in that case it's working fine. I check int this link, and this is a valid JSON.

[
    {
        "name": "bettype",
        "value": "All"
    },
    {
        "name": "bookies",
        "value": "Interwetten"
    },
    {
        "name": "sporttype",
        "value": "Soccer"
    },
    {
        "name": "team1",
        "value": "Braunschweig"
    },
    {
        "name": "team2",
        "value": "Bayern Munich"
    },
    {
        "name": "league",
        "value": "Germany DFB 开发者_开发问答Cup (90`)"
    }
]

UPDATED:

this is the server side code:

var_dump((stripslashes($_GET['data']));
var_dump(json_decode(stripslashes($_GET['data'])));

and this is the output:

string(244) "[{"name":"bettype","value":"All"},{"name":"bookies","value":"Interwetten"},{"name":"sporttype","value":"Soccer"},{"name":"team1","value":"Braunschweig"},{"name":"team2","value":"Bayern Munich"},{"name":"league","value":"Germany DFB Cup (90�)"}]" NULL 


It works fine for me.

http://sandbox.phpcode.eu/g/80941.php

Check your browser configuration/charset and try again

0

精彩评论

暂无评论...
验证码 换一张
取 消