本文整理了Java中com.alibaba.fastjson.JSON.toJSONStringWithDateFormat()
方法的一些代码示例,展示了JSON.toJSONStringWithDateFormat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.toJSONStringWithDateFormat()
方法的具体详情如下:
包路径:com.alibaba.fastjson.JSON
类名称:JSON
方法名:toJSONStringWithDateFormat
暂无
代码示例来源:origin: hs-web/hsweb-framework
@Override
public String toString() {
return JSON.toJSONStringWithDateFormat(this, "yyyy-MM-dd HH:mm:ss");
}
代码示例来源:origin: jfinal/jfinal
public String toJson(Object object) {
// 优先使用对象级的属性 datePattern, 然后才是全局性的 defaultDatePattern
String dp = datePattern != null ? datePattern : getDefaultDatePattern();
if (dp == null) {
return JSON.toJSONString(object);
} else {
return JSON.toJSONStringWithDateFormat(object, dp, SerializerFeature.WriteDateUseDateFormat); // return JSON.toJSONString(object, SerializerFeature.WriteDateUseDateFormat);
}
}
代码示例来源:origin: sxpl/FaceAC
/**
* 将对象解析为字符串
*/
public static final String toJSONString(Object object) {
return JSON.toJSONStringWithDateFormat(object, DEFFAULT_DATE_FORMAT, serializerFeature);
}
代码示例来源:origin: imadcn/idworker
private String jsonizeNodeInfo(NodeInfo nodeInfo) {
String dateFormat = "yyyy-MM-dd HH:mm:ss";
return JSON.toJSONStringWithDateFormat(nodeInfo, dateFormat, SerializerFeature.WriteDateUseDateFormat);
}
}
代码示例来源:origin: chxfantasy/spring-cloud-demo
public static String toJSONString(Object obj) {
return JSON.toJSONStringWithDateFormat(obj,
"yyyy-MM-dd HH:mm:ss",
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteNullBooleanAsFalse,
SerializerFeature.WriteNullListAsEmpty,
SerializerFeature.WriteNullNumberAsZero,
SerializerFeature.WriteNullStringAsEmpty,
SerializerFeature.DisableCircularReferenceDetect
);
}
}
代码示例来源:origin: shizuchengxuyuan/net.sz.java
public static String toJSONStringWithDateFormat(Date paramDate, String paramString) {
return JSON.toJSONStringWithDateFormat(paramDate, paramString, new SerializerFeature[]{SerializerFeature.WriteDateUseDateFormat});
}
代码示例来源:origin: org.hswebframework.web/hsweb-commons-controller
@Override
public String toString() {
return JSON.toJSONStringWithDateFormat(this, "yyyy-MM-dd HH:mm:ss");
}
代码示例来源:origin: MurasakiSeiFu/princess-sys
/**
* toString
*
* @date 2018/8/9 下午3:33
* @param: []
* @return: java.lang.String
*/
@Override
public String toString() {
return JSON.toJSONStringWithDateFormat(this, DateFormatUtils.PATTERN_DEFAULT_ON_SECOND);
}
代码示例来源:origin: MurasakiSeiFu/princess-sys
/**
* toString
*
* @date 2018/8/9 下午3:33
* @param: []
* @return: java.lang.String
*/
@Override
public String toString() {
return JSON.toJSONStringWithDateFormat(this, DateFormatUtils.PATTERN_DEFAULT_ON_SECOND);
}
代码示例来源:origin: org.hsweb/hsweb-web-core
@Override
public String toString() {
return JSON.toJSONStringWithDateFormat(this, DateTimeUtils.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
}
代码示例来源:origin: com.gitee.morilys.jsmile/jsmile-kit
public static String toJson(Object value) {
return JSON.toJSONStringWithDateFormat(value, "yyyy-MM-dd HH:mm:ss");
}
代码示例来源:origin: com.gitee.morilys.jsmile/jsmile-kit
public static String toJson(Object value, String dateFormat) {
return JSON.toJSONStringWithDateFormat(value, dateFormat);
}
代码示例来源:origin: shizuchengxuyuan/net.sz.java
public static String toJSONStringWithDateFormat(Date paramDate) {
return JSON.toJSONStringWithDateFormat(paramDate, "yyyy-MM-dd HH:mm:ss", new SerializerFeature[]{SerializerFeature.WriteDateUseDateFormat});
}
代码示例来源:origin: Nepxion/Thunder
public static <T> String toJson(T object) {
if (object == null) {
throw new SerializerException("Object is null");
}
return JSON.toJSONStringWithDateFormat(object, ThunderConstant.DATE_FORMAT, SerializerFeature.WriteClassName);
}
代码示例来源:origin: com.jfinal/jfinal
public String toJson(Object object) {
// 优先使用对象级的属性 datePattern, 然后才是全局性的 defaultDatePattern
String dp = datePattern != null ? datePattern : getDefaultDatePattern();
if (dp == null) {
return JSON.toJSONString(object);
} else {
return JSON.toJSONStringWithDateFormat(object, dp, SerializerFeature.WriteDateUseDateFormat); // return JSON.toJSONString(object, SerializerFeature.WriteDateUseDateFormat);
}
}
代码示例来源:origin: lcg0124/clouddo
/**
* Bean对象转JSON
*
* @param object
* @param dataFormatString
* @return
*/
public static String beanToJson(Object object, String dataFormatString) {
if (object != null) {
if (StringUtils.isEmpty(dataFormatString)) {
return JSONObject.toJSONString(object);
}
return JSON.toJSONStringWithDateFormat(object, dataFormatString);
} else {
return null;
}
}
代码示例来源:origin: biezhi/java-library-examples
public static void toJson(){
/**
* 单个对象
*/
Person person = BeanData.randPerson();
PrintUtils.print("Person 对象序列化为 JSON 字符串", JSON.toJSONString(person));
/**
* List对象
*/
List<Person> persons = BeanData.randPersons(5);
PrintUtils.print("Person 列表序列化为 JSON 字符串", JSON.toJSONString(persons));
/**
* 使用单引号
*/
PrintUtils.print("使用单引号", JSON.toJSONString(person, SerializerFeature.UseSingleQuotes));
/**
* 日期格式化
*/
PrintUtils.print("日期格式化", JSON.toJSONString(person, SerializerFeature.WriteDateUseDateFormat));
/**
* 指定日期格式
*/
PrintUtils.print("指定日期格式", JSON.toJSONStringWithDateFormat(person, "yyyy年MM月dd日"));
}
代码示例来源:origin: moonufo/galaxyLight
String urib = "http://" + instance.getHost() + ":" + instance.getPort() + "/add/" + a;
Integer methodb = 1;
String edateb = JSON.toJSONStringWithDateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
Integer etypeb = 1; // bapp etype = 1 BAPP start, 2ok 3:need
String edatea = JSON.toJSONStringWithDateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
String uria = "http://localhost:2220/add1/{a}?pevh={pevh}";
String eresponse = JSONObject.toJSONString(ReturnResult.class);
b.setId(66l);
Integer etypec = 5;
String edatec = JSON.toJSONStringWithDateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
String uric = "http://localhost:2220/add2/{ids}";
String parematerc = JSON.toJSONString(b, SerializerFeature.WriteClassName);
edatec = JSON.toJSONStringWithDateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
rs = 2;
edateb = JSON.toJSONStringWithDateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
thelp.send(rabbitTemplate,restTemplate, serviceNumber, 0, pathParematerb, bid, 1, eresponseb, urib, bapp, null, etypeb, methodb, null, edateb, 1);
if (rs == 1) {
内容来源于网络,如有侵权,请联系作者删除!