This question already has an answer here:

public function productDataToJson(Varien_Event_Observer $observer)
  $category = Mage::getModel('catalog/category');
  $tree = $category->getTreeModel();
  $ids = $tree->getCollection()->getAllIds();
  $jsonFilePath = Mage::getBaseDir().'/jsondata';
  foreach ($ids as $id) {
    $array = array();
    $products = $category->load($id)
    foreach ($products as $_product) {
        $array[] = array_merge($_product->getData(), array('category_ids' => $_product->getCategoryIds()));
    $jsonData = Mage::helper('core')->jsonEncode($array);
    file_put_contents($jsonFilePath.'/c_' . $id . '_node.json', $jsonData);

Currently I am getting attribute id's but not getting attribute lables. eg. Color:23,Size:345. But I want Color:Red, Size : XL etc.

marked as duplicate by Prince Patel, liyakat, Keyul Shah, brentwpeterson, Murtuza Zabuawala Jul 21 '17 at 18:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    No..I want the product data in json file with its attribute and attribute lables. – Sushant Thorat Jul 19 '17 at 13:09
  • This is my function in observer, i want to get json of all products details and attributes with its label. – Sushant Thorat Jul 20 '17 at 4:08