title: node.js require of a json file
body: <p>I am trying to require() this JSON file.</p>
  
  <pre><code>{
      "info" : function (request) {
          var i = "&lt;pre&gt;";
          i+= "current working directory: " + process.cwd() + "\n";
          i+="request url: " + request.url + "\n";
          i+= "&lt;/pre&gt;";
          return i;
      }
  }
  </code></pre>
  
  <p>Using this line</p>
  
  <pre><code>var render = require('./render.json');
  </code></pre>
  
  <p>But I get an exception from the JSON file of : Unexpected token u</p>
  
  <p>What am I doing wrong please ?</p>
  
  <p>The following works in a browser. Which I would expect, since a function is a object.
  And nodejs docs suggests JSON can be a module: <a href="http://nodejs.org/api/modules.html#modules_file_modules" rel="nofollow">http://nodejs.org/api/modules.html#modules_file_modules</a></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;script&gt;
  
    var a = {
      "b" : function(msg){
        alert(msg);
      }
    }
  
    a.b("Hello");
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>