mirror of
https://github.com/fankes/moshi.git
synced 2025-10-18 23:49:21 +08:00
* Rename .java to .kt * Convert JsonAdapter to Kotlin Note that there's more to be done here I think, namely exploring removing the NonNull adapter and making the nullSafe() adapter public so that nullability is directly in the API. Saving that for another day though * Update a couple usages * Fix override * Add exclusion for open * Add `@Language` annotation for json strings Allows the IDE to automatically make this pretty * Spotless * Nullable Co-authored-by: Egor Andreevich <egor@squareup.com> * When Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com> * Another when * Spotless Co-authored-by: Egor Andreevich <egor@squareup.com> Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>
Adapters
Prebuilt Moshi JsonAdapter
s for various things, such as Rfc3339DateJsonAdapter
for parsing java.util.Date
s
To use, supply an instance of your desired converter when building your Moshi
instance.
Moshi moshi = new Moshi.Builder()
.add(Date.class, new Rfc3339DateJsonAdapter())
//etc
.build();
Download
Download the latest JAR or grab via Maven:
<dependency>
<groupId>com.squareup.moshi</groupId>
<artifactId>moshi-adapters</artifactId>
<version>latest.version</version>
</dependency>
or Gradle:
implementation 'com.squareup.moshi:moshi-adapters:latest.version'
Snapshots of the development version are available in Sonatype's snapshots
repository.