<p dir="auto">using the following html form</p>
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;h1&gt;Debug Form&lt;/h1&gt;
&lt;form action=&quot;/debug&quot; method=&quot;POST&quot;&gt;
&lt;input name=&quot;item[1][name]&quot; value=&quot;&quot; /&gt;
&lt;input name=&quot;item[2][name]&quot; value=&quot;&quot; /&gt;
&lt;button type=&quot;submit&quot;&gt;test&lt;/button&gt;
&lt;/form&gt;"><pre class="notranslate"><span class="pl-kos">&lt;</span><span class="pl-ent">h1</span><span class="pl-kos">&gt;</span>Debug Form<span class="pl-kos">&lt;/</span><span class="pl-ent">h1</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">form</span> <span class="pl-c1">action</span>="<span class="pl-s">/debug</span>" <span class="pl-c1">method</span>="<span class="pl-s">POST</span>"<span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">input</span> <span class="pl-c1">name</span>="<span class="pl-s">item[1][name]</span>" <span class="pl-c1">value</span>="" /&gt;
<span class="pl-kos">&lt;</span><span class="pl-ent">input</span> <span class="pl-c1">name</span>="<span class="pl-s">item[2][name]</span>" <span class="pl-c1">value</span>="" /&gt;
<span class="pl-kos">&lt;</span><span class="pl-ent">button</span> <span class="pl-c1">type</span>="<span class="pl-s">submit</span>"<span class="pl-kos">&gt;</span>test<span class="pl-kos">&lt;/</span><span class="pl-ent">button</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">form</span><span class="pl-kos">&gt;</span></pre></div>
<p dir="auto">to the following flask application method / view</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@app.route('/debug', methods=[&quot;GET&quot;,&quot;POST&quot;,&quot;PUT&quot;,&quot;PATCH&quot;,&quot;DELETE&quot;])
def debug_info():
    return jsonify({&quot;data&quot;:request.data,&quot;formdata&quot;:request.form})"><pre class="notranslate"><span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">route</span>(<span class="pl-s">'/debug'</span>, <span class="pl-s1">methods</span><span class="pl-c1">=</span>[<span class="pl-s">"GET"</span>,<span class="pl-s">"POST"</span>,<span class="pl-s">"PUT"</span>,<span class="pl-s">"PATCH"</span>,<span class="pl-s">"DELETE"</span>])</span>
<span class="pl-k">def</span> <span class="pl-en">debug_info</span>():
    <span class="pl-k">return</span> <span class="pl-en">jsonify</span>({<span class="pl-s">"data"</span>:<span class="pl-s1">request</span>.<span class="pl-s1">data</span>,<span class="pl-s">"formdata"</span>:<span class="pl-s1">request</span>.<span class="pl-s1">form</span>})</pre></div>
<p dir="auto">I get</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;data&quot;: &quot;&quot;, 
  &quot;formdata&quot;: {
    &quot;item[1][name]&quot;: &quot;fdhnnhdsfsdslkkl&quot;, 
    &quot;item[2][name]&quot;: &quot;djdfhdjfh&quot;
  }
}"><pre class="notranslate">{
  <span class="pl-ent">"data"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>, 
  <span class="pl-ent">"formdata"</span>: {
    <span class="pl-ent">"item[1][name]"</span>: <span class="pl-s"><span class="pl-pds">"</span>fdhnnhdsfsdslkkl<span class="pl-pds">"</span></span>, 
    <span class="pl-ent">"item[2][name]"</span>: <span class="pl-s"><span class="pl-pds">"</span>djdfhdjfh<span class="pl-pds">"</span></span>
  }
}</pre></div>
<p dir="auto">I expected to see</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;data&quot;: &quot;&quot;, 
  &quot;formdata&quot;: {
    &quot;item&quot;:[
      {
         &quot;name&quot;: &quot;fdhnnhdsfsdslkkl&quot;
       },
       { 
         &quot;name&quot;: &quot;djdfhdjfh&quot;
       }
    ]
  }
}"><pre class="notranslate">{
  <span class="pl-ent">"data"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>, 
  <span class="pl-ent">"formdata"</span>: {
    <span class="pl-ent">"item"</span>:[
      {
         <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>fdhnnhdsfsdslkkl<span class="pl-pds">"</span></span>
       },
       { 
         <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>djdfhdjfh<span class="pl-pds">"</span></span>
       }
    ]
  }
}</pre></div>
<p dir="auto">The first and actual output requires further, more explicit parsing, from a sub-optimal data structure to achieve a nice dictionary; but I cannot see how the flat structure of the request.form object could be helping anyone...</p>
<p dir="auto">Rewrite the tutorial and corresponding example, taking into account new and common patterns for Flask.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> example</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> tutorial</li>
</ul>