title: Flask TypeError: 'method' object is not subscriptable
body: <p>I am building a dictionary app with Flask where users can add new words, the code below is the app.py file, I am having issues with the POST request, the error I am receiving on my terminal is this:</p>
  <pre class="lang-py prettyprint-override"><code>line 45, in add_word
      word = request.get_json['word']
  TypeError: 'method' object is not subscriptable
  </code></pre>
  <p><em>This code below is the app.py file</em></p>
  <pre><code>from flask import Flask, render_template, url_for, request
  from flaskext.mysql import MySQL
  import datetime
  import pymysql.cursors
  import json 
  
  app = Flask(__name__)
  
  app.config['MYSQL_DATABASE_HOST'] = 'localhost'
  app.config['MYSQL_DATABASE_DB'] = 'dictionary' 
  app.config['MYSQL_DATABASE_USER'] = 'root'
  app.config['MYSQL_DATABASE_PASSWORD'] = ''
  mysql = MySQL(app, cursorclass=pymysql.cursors.DictCursor)
  
  **@app.route('/', methods=['GET', 'POST'])**
  def index():
      user_response = ''
      if request.method == 'POST':
          *user_input = request.form['word']*
          conn = mysql.get_db()
          cur = conn.cursor() 
          cur.execute('select meaning from word where word=%s', (user_input) )
          rv = cur.fetchall()
          if (len(rv) &gt; 0):
              user_response = rv[0]['meaning']
          else:
              user_response = 'The word can not be found in this dictionary, please try again with another word'
          
      return render_template('index.html', user_response = user_response)
  
  @app.route('/dashboard')
  def dashboard():
      conn = mysql.get_db()
      cur = conn.cursor() 
      cur.execute('select * from word')
      rv = cur.fetchall()
      cur.close()
  
  return render_template('dashboard.html', words=rv)
  
  **@app.route('/word', methods=['POST'])
  def add_word():
      req = request.get_json() 
      word = request.get_json['word']
      meaning = request.get_json['meaning']
      conn = mysql.get_db()
      cur = conn.cursor() 
      cur.execute('insert into word(word, meaning) VALUES (%s, %s)', (word, meaning))
      conn.commit()
      cur.close()
  
      return json.dumps('success')
  
  if __name__ == &quot;__main__&quot;:
      app.run(debug=True)
  </code></pre>
  <p><em>here is my dashboard page or route:</em></p>
  <pre><code>{% extends 'base.html' %}
  
  {% block title %}
  &lt;title&gt;Dictionary App - Dashboard&lt;/title&gt;
  {% endblock %}
  {% block dash_active %}
  class=&quot;active&quot;
  {% endblock %}
  
  {% block content %}
  &lt;div class=&quot;row&quot;&gt;
      &lt;h2&gt;Word Index&lt;/h2&gt;
      &lt;div class=&quot;col-md-2 sidenav&quot;&gt;
          &lt;a href=&quot;#&quot; class=&quot;side-active&quot; id=&quot;word-index&quot;&gt;All Words&lt;/a&gt;
          &lt;a href=&quot;#&quot; id=&quot;word-add&quot;&gt;Add New&lt;/a&gt;
          &lt;div&gt;
              &lt;form action=&quot;javascript:0&quot; id=&quot;word-form&quot;&gt;
                  &lt;div class=&quot;form-group&quot;&gt;
                      &lt;label for=&quot;word&quot;&gt; Word:&lt;/label&gt;
                      &lt;input type=&quot;text&quot; 
                      class=&quot;form-control&quot; 
                      name=&quot;word&quot; id=&quot;word&quot; 
                      placeholder=&quot;Type in the word here: &quot;
                      required&gt; 
                  &lt;/div&gt;
                  &lt;div class=&quot;form-group&quot;&gt; 
                      &lt;label for=&quot;meaning&quot;&gt; Meaning: &lt;/label&gt;
                      &lt;textarea class=&quot;form-control&quot; id=&quot;meaning&quot; placeholder=&quot;Type the meaning of the word shows here:&quot; required&gt;&lt;/textarea&gt;
                  &lt;/div&gt;
                  &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary btn-block btn-lg&quot; id=&quot;submit&quot;&gt;Submit&lt;/button&gt;
                  &lt;button type=&quot;button&quot; class=&quot;btn btn-warning btn-block btn-lg&quot; id=&quot;cancel&quot;&gt;Cancel&lt;/button&gt;
                
  
              &lt;/form&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
      &lt;div class=&quot;col-md-10 main&quot;&gt;
      &lt;table class=&quot;table&quot;&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;SN&lt;/th&gt;
                  &lt;th&gt;Word&lt;/th&gt;
                  &lt;th&gt;Meaning&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
              {% for word in words %}
              &lt;tr&gt;
                  &lt;td&gt;{{loop.index}}&lt;/td&gt;
                  &lt;td&gt;{{word['word']}}&lt;/td&gt;
                  &lt;td&gt;{{word['meaning']}}&lt;/td&gt;
              &lt;/tr&gt;
              {% else %}
              &lt;tr&gt;
                  &lt;td colspan=&quot;3&quot;&gt;The Dictionary has no words at the moment&lt;/td&gt;
              &lt;/tr&gt;
              {% endfor %}
          &lt;/tbody&gt;
      &lt;/table&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  
  {% endblock %}
  </code></pre>