I'm new to JavaScript and PHP. I have read multiple stacks for answers but my JSON string is a little different. It's actually pretty easy if you ask me.
The string is as follows:
[[{"height":"444","width":"444","picture":"/image/data/122.jpg","x":0,"y":0,"currentheight":"444"},{"height":"444","width":"444","picture":"/image/data/122.jpg","y":"444","x":0,"currentheight":888},{"height":"223","width":"444","picture":"/image/data/122.jpg","y":888,"x":0,"currentheight":1111}],[{"height":"223","width":"444","picture":"/image/data/122.jpg","y":0,"x":444,"currentheight":"223"},{"height":"223","width":"444","picture":"/image/data/122.jpg","y":"223","x":444,"currentheight":446}]
Now I'm trying to decode it with json_decode($jsonstring, true)
, but it just doesn't get a value when I call it by it's index. As soon as I try to get data by using echo $jsonstring[0]
I get [
as the result. $jsonstring[0]['width']
doesn't even return anything.
Am I calling them wrong or is it something else?