xref: /aosp_15_r20/external/moshi/moshi-adapters/README.md (revision 238ab3e782f339ab327592a602fa7df0a3f729ad)
1*238ab3e7SAndroid Build Coastguard WorkerAdapters
2*238ab3e7SAndroid Build Coastguard Worker===================
3*238ab3e7SAndroid Build Coastguard Worker
4*238ab3e7SAndroid Build Coastguard WorkerPrebuilt Moshi `JsonAdapter`s for various things, such as `Rfc3339DateJsonAdapter` for parsing `java.util.Date`s
5*238ab3e7SAndroid Build Coastguard Worker
6*238ab3e7SAndroid Build Coastguard WorkerTo use, supply an instance of your desired converter when building your `Moshi` instance.
7*238ab3e7SAndroid Build Coastguard Worker
8*238ab3e7SAndroid Build Coastguard Worker```java
9*238ab3e7SAndroid Build Coastguard WorkerMoshi moshi = new Moshi.Builder()
10*238ab3e7SAndroid Build Coastguard Worker    .add(Date.class, new Rfc3339DateJsonAdapter())
11*238ab3e7SAndroid Build Coastguard Worker    //etc
12*238ab3e7SAndroid Build Coastguard Worker    .build();
13*238ab3e7SAndroid Build Coastguard Worker```
14*238ab3e7SAndroid Build Coastguard Worker
15*238ab3e7SAndroid Build Coastguard WorkerDownload
16*238ab3e7SAndroid Build Coastguard Worker--------
17*238ab3e7SAndroid Build Coastguard Worker
18*238ab3e7SAndroid Build Coastguard WorkerDownload [the latest JAR][1] or grab via [Maven][2]:
19*238ab3e7SAndroid Build Coastguard Worker```xml
20*238ab3e7SAndroid Build Coastguard Worker<dependency>
21*238ab3e7SAndroid Build Coastguard Worker  <groupId>com.squareup.moshi</groupId>
22*238ab3e7SAndroid Build Coastguard Worker  <artifactId>moshi-adapters</artifactId>
23*238ab3e7SAndroid Build Coastguard Worker  <version>latest.version</version>
24*238ab3e7SAndroid Build Coastguard Worker</dependency>
25*238ab3e7SAndroid Build Coastguard Worker```
26*238ab3e7SAndroid Build Coastguard Workeror [Gradle][2]:
27*238ab3e7SAndroid Build Coastguard Worker```groovy
28*238ab3e7SAndroid Build Coastguard Workerimplementation 'com.squareup.moshi:moshi-adapters:latest.version'
29*238ab3e7SAndroid Build Coastguard Worker```
30*238ab3e7SAndroid Build Coastguard Worker
31*238ab3e7SAndroid Build Coastguard WorkerSnapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
32*238ab3e7SAndroid Build Coastguard Worker
33*238ab3e7SAndroid Build Coastguard Worker
34*238ab3e7SAndroid Build Coastguard Worker
35*238ab3e7SAndroid Build Coastguard Worker [1]: https://search.maven.org/remote_content?g=com.squareup.moshi&a=moshi-adapters&v=LATEST
36*238ab3e7SAndroid Build Coastguard Worker [2]: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.squareup.moshi%22%20a%3A%22moshi-adapters%22
37*238ab3e7SAndroid Build Coastguard Worker [snap]: https://oss.sonatype.org/content/repositories/snapshots/com/squareup/moshi/moshi-adapters/
38