From ab5b3a468e20d9681df31c80c5fba6140a4e876e Mon Sep 17 00:00:00 2001 From: John Carlson Date: Wed, 26 Jul 2017 12:42:02 -0500 Subject: [PATCH] Add moshi-kotlin documentation --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 81d9ce4..b5716da 100644 --- a/README.md +++ b/README.md @@ -472,6 +472,14 @@ public final class BlackjackHand { } ``` +### Kotlin Support + +Kotlin classes work with Moshi out of the box, with the exception of annotations. If you need to annotate your Kotlin classes with an `@Json` annotation or otherwise, you will need to use the `moshi-kotlin` artifact, and set up Moshi to use its converter factory: +```kotlin +val moshi = Moshi.Builder() + .add(KotlinJsonAdapterFactory()) + .build() +``` Download -------- @@ -488,6 +496,18 @@ or Gradle: ```groovy compile 'com.squareup.moshi:moshi:1.5.0' ``` +and for additional Kotlin support: +```xml + + com.squareup.moshi + moshi-kotlin + 1.5.0 + +``` +or Gradle: +```groovy +compile 'com.squareup.moshi:moshi-kotlin:1.5.0' +``` Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap]. @@ -504,7 +524,12 @@ If you are using ProGuard you might need to add the following options: @com.squareup.moshi.* ; } ``` - +Additional rules are needed if you are using the Kotlin artifact: +``` +-keepclassmembers class kotlin.Metadata { + public ; +} +``` License --------