code: def to_json_value(obj, fieldname, value=_marker, default=None):
      
  
      # This function bridges the value of the field to a probably more complex
      # JSON structure to return to the client.
  
      # extract the value from the object if omitted
      if value is _marker:
          value = IDataManager(obj).json_data(fieldname)
  
      # convert objects
      if isinstance(value, ImplicitAcquisitionWrapper):
          return get_url_info(value)
  
      # check if the value is callable
      if callable(value):
          value = value()
  
      # convert dates
      if is_date(value):
          return to_iso_date(value)
  
      # check if the value is JSON serializable
      if not is_json_serializable(value):
          logger.warn("Output {} is not JSON serializable".format(repr(value)))
          return default
  
      return value
docs: JSON save value encoding
  
      :param obj: Content object
      :type obj: ATContentType/DexterityContentType
      :param fieldname: Schema name of the field
      :type fieldname: str/unicode
      :param value: The field value
      :type value: depends on the field type
      :returns: JSON encoded field value
      :rtype: field dependent