I have built a very simple Python API using flask, my response looks like this...
response = {
"id" : "345345d",
"topdata" : {
"top" : 234,
"left" : 42,
},
"bottomdata" : {
"color" : "red",
"bg" : "black",
},
}
return jsonify(response)
I then try and decode that response in my PHP script like this...
$response = json_decode($response);
But this gives me the following error..
Cannot use object of type stdClass as array
Anyone any ideas where I am going wrong?
$responsebefore sending it tojson_decode? Does it look like valid JSON? Does it look like what you expected it to be?