2

So, I'm using file_get_contents(url) to return some JSON data. When I use var_dump(json_decode($result, true)); it always returns NULL

I used echo json_last_error(); and that returns 0, indicating no error.

I've spent ages trying to find a solution to my problem. (Also this is the first time I've ever used JSON)

What could possibly be wrong here?

Here is the value of result when I just request 1 item (It's long, so I'm just gonna show 1)

{
  "Items": [
    {
      "Id": 1034,
      "Name": "Direzza DZ102",
      "TyreBrand": {
      "Id": 10,
      "Name": "Dunlop"
    },
      "ShortDescription": "An aggressively styled sports performance tyre that is guaranteed to deliver. With features such as advanced handling in wet and dry conditions, Hydrogrip braking technologies, reduced fuel consumption and noise reduction. The Direzza DZ102 is the sports performance tyre that won't     disappoint.",
      "Images": [
        {
          "Id": "0b2773b6-eb10-4eea-bd69-3061cf4e6778",
          "Url": "https://vlogicmedia1.blob.core.windows.net/tyre-images/19/0b2773b6-eb10-4eea-bd69-3061cf4e6778.png",
          "Type": "Manf Angle Large",
          "Caption": ""
        },
        {
          "Id": "ac474cc2-30ce-43df-9856-d0a1ad722acd",
          "Url": "https://vlogicmedia1.blob.core.windows.net/tyre-images/18/ac474cc2-30ce-43df-9856-d0a1ad722acd.png",
          "Type": "Manf Angle Main",
          "Caption": null
        },
        {
          "Id": "1a386318-a4ee-4c5e-a808-e9b3031eeb82",
          "Url": "https://vlogicmedia1.blob.core.windows.net/tyre-    images/17/1a386318-a4ee-4c5e-a808-e9b3031eeb82.png",
          "Type": "Manf Angle Thumb",
          "Caption": null
        }
      ],
      "PerformanceCategory": "Ultra High Performance"
    }
  ],
  "Page": 1,
  "PerPage": 1,
  "Total": 40
}
Garis M Suero
  • 7,974
  • 7
  • 45
  • 68
Zoron19
  • 594
  • 5
  • 7

0 Answers0