docs: def json_to_data(fn=None, return_json=True):
      """
      Decode JSON from the request and add it as ``data`` parameter for wrapped
      function.
  
      Args:
          return_json (bool, default True): Should the decorator automatically
                      convert returned value to JSON?
      """
      def json_to_data_decorator(fn):
          @handle_type_error
          @wraps(fn)
          def get_data_wrapper(*args, **kwargs):
              kwargs["data"] = decode_json_body()
  
              if not return_json:
                  return fn(*args, **kwargs)
  
              return encode_json_body(
                  fn(*args, **kwargs)
              )
  
          return get_data_wrapper
  
      if fn:  # python decorator with optional parameters bukkake
          return json_to_data_decorator(fn)
  
      return json_to_data_decorator