title: jsonify is not defined - Internal Server Error
body: <p>Playing around with Flask and just wanted to print out some data as JSON formatted, but I keep getting the error: </p>
  
  <blockquote>
    <p>NameError: global name 'jsonify' is not defined</p>
  </blockquote>
  
  <pre><code>from flask import Flask
  from flask import json
  app = Flask(__name__)
  
  @app.route("/")
  def testJSON():
          x = "Test1"
          y = "Test2"
          return jsonify(a=x,z=y)
  
  if __name__ == "__main__":
          app.debug = True
          app.run()
  </code></pre>
  
  <p>Their <a href="http://flask.pocoo.org/docs/api/#returning-json">documentation</a> says that I either need Python 2.6 or simplejson to be installed - I have both.</p>
  
  <p>Python 2.7.3:</p>
  
  <blockquote>
    <p>sys.version
    '2.7.3 (default, May  9 2012, 23:42:16) \n[GCC 4.4.3]'</p>
  </blockquote>
  
  <p>simplejson:</p>
  
  <blockquote>
    <p>root@Python:~/PythonScripts# pip install simplejson
    Requirement already satisfied (use --upgrade to upgrade): simplejson in /usr/local/lib/python2.7/site-packages
    Cleaning up...</p>
  </blockquote>