I have a JSON-String like
{"aaa":"foo", "bbb":"bar", "ccc":"hello", "ddd":"world"}
Actually I recive this string via $_GET. It is base64 encoded and if I decode it I have this string.
So further is want to use this in PHP as an object. For this is do
$data = json_decode( base64_decode( $_GET['data'] ) );
but $data is NULL all the time. If I do
echo base64_decode( $_GET['data'] );
Then the valid JSON-String is printed as expacted.
What am I doing wrong ?
I have tried to call the base64_encode before but same result...
var_dump(base64_decode($_GET['data']));, maybe it's html encoded...echo json_last_error();to see what error the json parser encounters?json_last_errorreturns 5 then it is very likely that the JSON you have is in fact not valid, as it contains malformed UTF-8 sequences. I really can't help you without seeing the data you are handling.