This
"rows": {...}
and this
"rows": [{...}]
are two distinctly different things.
To figure out what you have to use to access something, work from the outside in.
1 {
2 "column-names": [
3 "address1",
4 "address2",
5 "address3",
6 "postcode",
7 ...
8 ],
9 "rows": [
10 {
11 "address": "123, Imaginary Road",
12 "someotherdata": dataset,
13 ...,
14 "postcode": "H3L L00"
15 }
16 ]
17 }
If you want the "address" on line 11 then you have to go through:
1. The outermost thing is an object (line 1)
2. The "rows" member is an array (line 9)
3. The first item in that array is an object (line 10)
4. The "address" member
Since you told json_decode() that you want objects to be converted into arrays, then that means you:
1. Start with the thing returned to you by json_decode(), which will be an array
2. Get the "rows" member
3. Get the first member, which would be the 0th
4. Get the "address" member
In the real world, if you have something called "rows" that is a JSON [ ] array then you probably shouldn't be using direct offsets on it (eg, 0) but rather a loop to get all the things inside it.