[ create a new paste ] login | about

Link: http://codepad.org/5BKi9sPp    [ 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, true);

echo 'RESULT:' . PHP_EOL;
echo 'thumbnail: ' . $decoded_json['thumbnailUrl'] . PHP_EOL;
echo 'thumbnail: ' . $decoded_json['price'] . PHP_EOL;


Output:
1
2
3
RESULT:
thumbnail: thumbnail URL here
thumbnail: 99.99


Create a new paste based on this one


Comments: