code: def wrap_json(func=None, *, encoder=json.JSONEncoder, preserve_raw_body=False):
      
  
      if func is None:
          return functools.partial(
              wrap_json,
              encoder=encoder,
              preserve_raw_body=preserve_raw_body
          )
  
      wrapped_func = wrap_json_body(func, preserve_raw_body=preserve_raw_body)
      wrapped_func = wrap_json_response(wrapped_func, encoder=encoder)
      return wrapped_func
docs: A middleware that parses the body of json requests and
      encodes the json responses.
  
      NOTE: this middleware exists just for backward compatibility,
      but it has some limitations in terms of response body encoding
      because it only accept list or dictionary outputs and json
      specification allows store other values also.
  
      It is recommended use the `wrap_json_body` and wrap_json_response`
      instead of this.