title: Python - convert image to JSON
body: <p>I need to convert an image (can be any type jpg, png etc.) to JSON serializable. </p>
  
  <p>I looked into the solution <a href="https://stackoverflow.com/questions/45135892/how-to-convert-image-data-so-it-can-be-json-serializable-and-vice-versa">here</a> but the accepted solution has a typo and I am not sure how to resolve it. </p>