Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
Problem while using flask and Json.parse in JS

I'm facing an issue with the JS function JSON.parse().

I'm working with the flask framework and my goal is to send a JSON response from web to my html template.

@app.route('/index', methods=['GET','POST'])
def index():
     response_API = requests.get('http://127.0.0.1:5001/api/lotnumbers')
    
     dataJson = response_API.json()

     if request.method == "POST":
        print(request.form.getlist('checkbox-case'))
     return render_template('generate.html', excel=dataJson)

And I try to retrieve my data like this :

<script>

var table = JSON.parse('{{excel | tojson | safe}}');
console.log(table);

</script>

But I have always this error : Uncaught SyntaxError: Unexpected token in JSON at position 18 at JSON.parse () at (index):95:22

What's the best way to retrieve my data from a Web Response ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!