1

I'm using jsonify function to return in Flask:

 return jsonify(results = results_arr)

and I'm getting output like this:

{"results":[{"image":"103901.jpg","score":"2.51322851309"},{"image":"103401.jpg","score":"5.93861453397"}]}

I tried to do this in django by:

return json.dumps(results = results_arr)

But it doesn't work like on jsonify on Flask, can someone help me with this?

2
  • In Flask return jsonify(...) returns an HTTP response but return json.dumps(...) does not do the same. You need to use return JsonResponse({'results': results_arr}) Commented Dec 13, 2016 at 16:50
  • @ettanany Thank you, it solved my problem! Commented Dec 13, 2016 at 16:52

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.