code: protected static final Writer writeValue(Writer writer, Object value, int indentFactor, int indent, JSONConfig config) throws JSONException, IOException {
  		if (value == null || value instanceof JSONNull) {
  			writer.write(JSONNull.NULL.toString());
  		} else if (value instanceof JSON) {
  			((JSON) value).write(writer, indentFactor, indent);
  		} else if (value instanceof Map) {
  			new JSONObject((Map<?, ?>) value).write(writer, indentFactor, indent);
  		} else if (value instanceof Iterable || value instanceof Iterator || value.getClass().isArray()) {
  			new JSONArray(value).write(writer, indentFactor, indent);
  		} else if (value instanceof Number) {
  			writer.write(NumberUtil.toStr((Number) value));
  		} else if (value instanceof Date || value instanceof Calendar) {
  			final String format = (null == config) ? null : config.getDateFormat();
  			writer.write(formatDate(value, format));
  		} else if (value instanceof Boolean) {
  			writer.write(value.toString());
  		} else if (value instanceof JSONString) {
  			Object o;
  			try {
  				o = ((JSONString) value).toJSONString();
  			} catch (Exception e) {
  				throw new JSONException(e);
  			}
  			writer.write(o != null ? o.toString() : JSONUtil.quote(value.toString()));
  		} else {
  			JSONUtil.quote(value.toString(), writer);
  		}
  		return writer;
  	}
docs: 写入值到Writer
  
  @param writer Writer
  @param value 值
  @param indentFactor 每一级别的缩进量
  @param indent 缩进空格数
  @param config 配置项
  @return Writer
  @throws JSONException
  @throws IOException