mirror of
https://github.com/fankes/moshi.git
synced 2025-10-19 16:09:21 +08:00
@@ -230,9 +230,8 @@ For example, if you have an adapter that doesn't support nullable values, you ca
|
|||||||
String dateJson = "\"2018-11-26T11:04:19.342668Z\"";
|
String dateJson = "\"2018-11-26T11:04:19.342668Z\"";
|
||||||
String nullDateJson = "null";
|
String nullDateJson = "null";
|
||||||
|
|
||||||
// RFC 3339 date adapter, doesn't support null by default
|
// Hypothetical IsoDateDapter, doesn't support null by default
|
||||||
// See also: https://github.com/square/moshi/tree/master/adapters
|
JsonAdapter<Date> adapter = new IsoDateDapter();
|
||||||
JsonAdapter<Date> adapter = new Rfc3339DateJsonAdapter();
|
|
||||||
|
|
||||||
Date date = adapter.fromJson(dateJson);
|
Date date = adapter.fromJson(dateJson);
|
||||||
System.out.println(date); // Mon Nov 26 12:04:19 CET 2018
|
System.out.println(date); // Mon Nov 26 12:04:19 CET 2018
|
||||||
|
Reference in New Issue
Block a user