4

I am quite new to python and Flask and in a recent code review I had quite interesting conversation about using the json package to parse a json response. My code was simply doing this:

return json.loads(response.text)

The suggested change was actually asking for move to a more convenient

return response.json()

using the request package.

Not sure what should really be the outcome of this change. Any manual and example found online use the json library.

Can someone help me to understand the main difference (if it exists) ?

Thanks for your help.

MiH
  • 354
  • 4
  • 11
vertigo
  • 41
  • 1
  • 1
    Here's the answer: `.json()` is better -- https://stackoverflow.com/questions/58048879/what-is-the-difference-between-json-method-and-json-loads/67758611#67758611 – MiH May 30 '21 at 13:32

0 Answers0