code: def jsonify(obj, status=200, headers=None, refs=False, encoder=JSONEncoder):
      
      if encoder is JSONEncoder:
          data = encoder(refs=refs).encode(obj)
      else:
          data = encoder().encode(obj)
      if 'callback' in request.args:
          cb = request.args.get('callback')
          data = '%s && %s(%s)' % (cb, cb, data)
      return Response(data, headers=headers,
                      status=status,
                      mimetype='application/json')
docs: Custom JSONificaton to support obj.to_dict protocol.