0

I need to pass a JSON object from the back end of my flask application to be used by the client. Unfortunately, in the browser, it is not being recognised as a JSON object as the quotemarks get encoded differently.

I use json.dumps() in python and then pass this into the browser using render_template(). However, once this is passed to the browser, the object appears as so:

{"0": {"word_id": 5, "body": "man", "UWL_id": 5, "sentences":
Dave Cook
  • 617
  • 1
  • 5
  • 17
  • 1
    Although I'm not into flask, i may have found an answer for you: You should declare it `safe`. See https://stackoverflow.com/a/3206446/9898643 – Theo Jul 15 '18 at 19:31

1 Answers1

0

Found the answer here.

It seems that jinja is able to format json in the template using the |tojson filter

Dave Cook
  • 617
  • 1
  • 5
  • 17