code: def validate_json(f):
      
      @wraps(f)
      def wrapper(*args, **kw):
          instance = args[0]
          try:
              if request.get_json() is None:
                  ret_dict = instance._create_ret_object(instance.FAILURE,
                                                         None, True,
                                                         instance.MUST_JSON)
                  instance.logger.error(instance.MUST_JSON)
                  return jsonify(ret_dict), 400
          except BadRequest:
              ret_dict = instance._create_ret_object(instance.FAILURE, None,
                                                     True,
                                                     instance.MUST_JSON)
              instance.logger.error(instance.MUST_JSON)
              return jsonify(ret_dict), 400
          instance.logger.debug("JSON is valid")
          return f(*args, **kw)
      return wrapper
docs: Validate that the call is JSON.