Q:

Template that iterates through channel entries and outputs categories that are selected for each entry

I've found it perfectly possible to output a list of all of the categories for a channel, or a list of all of the categories that are not empty for a channel.  But when I am iterating through the different posts of a channel, how can I output for each post only the categories that are checked for that specific channel entry?  
I've read through the documentation pretty thoroughly, http://ellislab.com/expressionengine/user-guide/modules/channel/categories.html, and I can't seem to find a way to make it work.  
I'm trying to spit this information out as JSON... to put it into context, below is what I have as a base.  Ideally I would like to nest an array in my associative array that contains all of the categories for that channel entry. 
<? php

  $entries = array();

  {exp:channel:entries channel="my_channel_entries" dynamic="yes"}
    $entries[] = array(
      'name' => '{entry_name}',
      'description' => '{description}'          
    );
  {/exp:channel:entries}

  header('Content-type: application/json');
  echo json_encode($entries, JSON_PRETTY_PRINT);
  exit;

? > 

Any help/creative problem solving that you all can offer will be greatly appreciated!  Let me know if I can provide any more details to help you, help me. 

A:

I got bogged down with {exp:channel:categories} when I was getting started; in this context, you'll want to use the {categories} tag pair within {exp:channel:entries}.