开发者

json data returned Response 14 bytes [200 OK] instead of displaying JSON data on flask app

i am now currently facing a problem where i cant display the json data onto the flask view. whenever i got the data and trying to display it on the view, i am not able to display the json data.

instead of returning the data in json form it returns nothing but Response 14 bytes [200 OK]. where am i doing it wrong? here's the code i have.

@app.route('/prediction', methods=['GET','POST'])
def predict():
  if request.method == 'GET':
    data1 = request.get_json()
    return render_template('index.html', data = jsonify(data1))

as for html i have a simple one which is this

<!DOCTYPE html>
<html lang="en">
<head>Prediction Test</head>
<body>

<div>{{data}}<开发者_开发问答;/div>

</body>
</html>

and the response i have is this:

Prediction Test
<Response 14 bytes [200 OK]>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜