Heim  >  Fragen und Antworten  >  Hauptteil

java – Die Vor- und Nachteile verschiedener Methoden für FastJSON zur Datentypkonvertierung

ExpIssue exp = new ExpIssue();
    exp.setCreateTime(new Date());
    exp.setDealContent("liahodbfoasdhf");
第一种: String jstr = JSON.toJSONStringWithDateFormat(exp, "yyyy-MM-dd HH:mm:ss");
第二种: String ste =  JSON.toJSONString(exp, SerializerFeature.WriteDateUseDateFormat);
第三种:SerializeConfig mapping = new SerializeConfig();
       mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
       String json = JSONObject.toJSONString(issue,mapping,SerializerFeature.WriteDateUseDateFormat);
            
            

Bitte fragen Sie die Experten um Hilfe, welches Gerät aufgrund einer genauen Konvertierung bei hoher Parallelität eine bessere Leistung bietet

世界只因有你世界只因有你2655 Tage vor697

Antworte allen(1)Ich werde antworten

  • 淡淡烟草味

    淡淡烟草味2017-06-10 09:50:00

    传时间最好是用Unix时间戳(用秒还是毫秒,两边约定好就可以了)。

    yyyy-MM-dd HH:mm:ss的话,碰到两边服务器时区不一样,多半要出问题的。

    Antwort
    0
  • StornierenAntwort