title: Drupal parsing JSON to iPhone
body: <p>Bellow is the code for a custom module that parses json to ios devices. The thing is on my drupal page I've created a node hierarcy using "nodehierarcy" module. I've got two types of custom contents - phones and events. For each phone I have a list of events which I want to parse. The problem with the code below is that it's parsing all of the jobs instead of categorizing them per device. The json output url is: "xyz.com/job/json". But I want something like <code>xyz.com/?q=node/4/json</code>, node 4 representing a phone. Any ideas? </p>
  
  <p>
  
  <pre><code>function job_menu() {
      $items =array();
  
      $items['job/json'] = array(
          'title' =&gt; 'Json callback',
          'page callback' =&gt; 'message_json_page',
          'access arguments' =&gt; array('access content'),
          'type' =&gt; MENU_CALLBACK,
      );
      return $items;   
  }
  
  function message_json_page(){
      $sql = "SELECT n.nid , n.title as name FROM {node} n 
              WHERE n.status = 1 and n.type = :type";
      $result = db_query($sql, array(':type'=&gt;'job'))-&gt;fetchAll();
      $json_value = json_encode($result);
      print $json_value;
  }
  </code></pre>