code: def prettify_json(json_string):
      
      try:
          data = json.loads(json_string)
          html = '<pre>' + json.dumps(data, sort_keys=True, indent=4) + '</pre>'
      except:
          html = json_string
      return mark_safe(html)
docs: Given a JSON string, it returns it as a
      safe formatted HTML