title: How to return the passed variable url parameter in json
body: <p>I have a flask app. I want it to write the variable parameters passed through the URL end point to an out-file.</p>
  
  <p>I tried it writing to an out-file, but the name passed in URL endpoint is not getting printed in the out-file. Please suggest the way so that the out-file could be dynamically altered when passed the variable endpoint</p>
  
  <pre class="lang-py prettyprint-override"><code>from flask import Flask, jsonify
  import json
  import uuid 
  
  
  app = Flask(__name__)
  
  
  @app.route('/&lt;string:name&gt;')
  def get_stats(name):
      proceuudi = uuid.uuid4()
  
      stat = [
          {
              'process_id': str(proceuudi),
              'process_name': 'name' 
          }
      ]
  
      with open('data.txt', 'w+') as f:  # writing JSON object
          json.dump(stat, f)
      return jsonify({'stats':stat})
  app.run(port = 8500)
  </code></pre>
  
  <p>When hitting the url  <a href="http://127.0.0.1:2700/generate" rel="nofollow noreferrer">http://127.0.0.1:2700/generate</a>
  The output i am getting in outfile is</p>
  
  <pre><code>[{"process_name": "favicon.ico", "process_id": "82daa01c-bb2d-444c-9b44-a8880200cb2a"}]
  </code></pre>
  
  <p>Here the "process_name" should be generate as passed in URL parameter. But i am getting favicon.ico</p>