Flask: Url_for argument is passed as query parameter
<p>I'm trying to pass a json object to url_for, but it's passed as a query parameter (appended to the URL) instead of being passed as an argument to the function, hence getting a 'Missing positional argument' error. Using Flask on Python 3.5.</p>

<p>Any help appreciated. Thanks!</p>

<p>My code:</p>

<pre><code>##VIEWS.PY
@projects.route('/exportdata', methods=['GET','POST'])
def exportdata(export):
    return Response(export,
            mimetype='application/json',
            headers={'Content-Disposition': 'attachment;filename=export.json'})
</code></pre>

<hr>

<pre><code>&lt;!-- HTML--&gt;
&lt;p&gt; Download data &lt;a href="{{ url_for('projects.exportdata', export=export) }}"&gt;here &lt;/a&gt;&lt;/p&gt;
</code></pre>

<p><a href="https://i.stack.imgur.com/yQHyZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yQHyZ.png" alt="Error"></a></p>