[ create a new paste ] login | about

Link: http://codepad.org/ZARAK3Er    [ raw code | output | fork ]

PHP, pasted on Mar 21:
<?php
 
$json = '{
  "id": 8443685,
  "sku": "KEN000025",
  "smallThumbnailUrl": "picture URL here",
  "thumbnailUrl": "thumbnail URL here",
  "imageUrl": "image URL here",
  "name": "Kenwood Excelon KFC-X173",
  "price": 99.99,
  "weight": 1.0,
  "url": "long URL here",
  "description": "long description here",
  "options": [],
  "taxes": [],
  "galleryImages": [],
  "categories": [
    {
      "id": 769355,
      "thumbnailUrl": "url here",
      "name": "Speakers",
      "url": "url here",
      "description": ""
    },
    {
      "id": 1466304,
      "parentId": 1466305,
      "thumbnailUrl": "URL here",
      "name": "Kenwood",
      "url": "URL here",
      "description": ""
    }
  ],
  "dateAdded": 1325037351
}';
 
$decoded_json = json_decode($json);
var_dump($decoded_json);


Output:
object(stdClass)#1 (15) {
  ["id"]=>
  int(8443685)
  ["sku"]=>
  string(9) "KEN000025"
  ["smallThumbnailUrl"]=>
  string(16) "picture URL here"
  ["thumbnailUrl"]=>
  string(18) "thumbnail URL here"
  ["imageUrl"]=>
  string(14) "image URL here"
  ["name"]=>
  string(24) "Kenwood Excelon KFC-X173"
  ["price"]=>
  float(99.99)
  ["weight"]=>
  float(1)
  ["url"]=>
  string(13) "long URL here"
  ["description"]=>
  string(21) "long description here"
  ["options"]=>
  array(0) {
  }
  ["taxes"]=>
  array(0) {
  }
  ["galleryImages"]=>
  array(0) {
  }
  ["categories"]=>
  array(2) {
    [0]=>
    object(stdClass)#2 (5) {
      ["id"]=>
      int(769355)
      ["thumbnailUrl"]=>
      string(8) "url here"
      ["name"]=>
      string(8) "Speakers"
      ["url"]=>
      string(8) "url here"
      ["description"]=>
      string(0) ""
    }
    [1]=>
    object(stdClass)#3 (6) {
      ["id"]=>
      int(1466304)
      ["parentId"]=>
      int(1466305)
      ["thumbnailUrl"]=>
      string(8) "URL here"
      ["name"]=>
      string(7) "Kenwood"
      ["url"]=>
      string(8) "URL here"
      ["description"]=>
      string(0) ""
    }
  }
  ["dateAdded"]=>
  int(1325037351)
}


Create a new paste based on this one


Comments: