Files
moshi/moshi-adapters
Zac Sweers 47697c2601 Convert JsonReader to Kotlin (#1505)
* Rename .java to .kt

* Convert JsonReader to Kotlin

Made it sealed along the way like JsonWriter

Some of the properties had different docs for setting and getting, which dokka doesn't seem to have a nice way to differentiate. Went with a little marked up form but open to suggestions.

* Restore isLenient name to lenient

This plays nice for both java and kotlin consumers, as it's still isLenient to java consumers but not a source breaking change for kotlin

* Fix peek nullability and a kotlin source change

* Fix another nullability

* Use collection builders

* Ok this didn't work quite as I expected

* Update moshi/src/main/java/com/squareup/moshi/JsonReader.kt

Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>

Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>
2022-01-17 02:52:02 -05:00
..
2022-01-17 02:52:02 -05:00
2021-12-23 11:44:24 -05:00

Adapters

Prebuilt Moshi JsonAdapters for various things, such as Rfc3339DateJsonAdapter for parsing java.util.Dates

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.