moshi | A modern JSON library for Kotlin and Java | JSON Processing library

 by   square Kotlin Version: 1.15.0 License: Apache-2.0

kandi X-RAY | moshi Summary

kandi X-RAY | moshi Summary

moshi is a Kotlin library typically used in Utilities, JSON Processing, Gradle applications. moshi has no vulnerabilities, it has a Permissive License and it has high support. However moshi has 8 bugs. You can download it from GitHub.

Moshi is a modern JSON library for Android, Java and Kotlin. It makes it easy to parse JSON into Java and Kotlin classes:.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              moshi has a highly active ecosystem.
              It has 9011 star(s) with 736 fork(s). There are 181 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 79 open issues and 748 have been closed. On average issues are closed in 24 days. There are 8 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of moshi is 1.15.0

            kandi-Quality Quality

              moshi has 8 bugs (0 blocker, 0 critical, 7 major, 1 minor) and 490 code smells.

            kandi-Security Security

              moshi has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              moshi code analysis shows 0 unresolved vulnerabilities.
              There are 1 security hotspots that need review.

            kandi-License License

              moshi is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              moshi releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.
              moshi saves you 11705 person hours of effort in developing the same functionality from scratch.
              It has 26897 lines of code, 1694 functions and 139 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed moshi and discovered the below as its top functions. This is intended to give you an instant insight into moshi implemented functionality, and help decide if they suit your requirements.
            • Reads and writes the Rfc3339 dates
            • Creates a new date
            • Runs the game
            • Main method
            • Runs the application
            • The main method
            • Main entry point
            • The main entry point
            • Runs the card
            • Returns the string representation of the item
            • Read JSON
            • Deserialize a JSON card
            • Constructs a value from a JSON object
            • Serializes the delegate
            • Serialize a card
            • The entry point
            • Returns string representation
            Get all kandi verified functions for this library.

            moshi Key Features

            No Key Features are available at this moment for moshi.

            moshi Examples and Code Snippets

            moshi: parsing a json response from okhttp3
            Javadot img1Lines of Code : 146dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            public class Root {
                public Query query;
                public String language;
                public String preferedReferential;
                public String bestMatch;
                public List results;
                public String version;
                public int remainingIdentificationRequests;
            Moshi with Retrofit send empty request
            Javadot img2Lines of Code : 19dot img2License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
                @Singleton
                @Provides
                fun provideMoshi(): Moshi =
                    Moshi.Builder()
                        .add(KotlinJsonAdapterFactory())
                        .build()
                
                @Singleton
                @Provides
                fun provideMoshiConverterFactory(moshi: Moshi): Mo
            ProGuard: ClassCastException with Moshi+Retrofit
            Lines of Code : 125dot img3License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            # Add project specific ProGuard rules here.
            # You can control the set of applied configuration files using the
            # proguardFiles setting in build.gradle.
            #
            # For more details, see
            #   http://developer.android.com/guide/developing/tools/progu
            How to pass object in navigation in jetpack compose?
            Lines of Code : 65dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            val ROUTE_USER_DETAILS = "user-details/{user}"
            
            
            // Pass data (I am using Moshi here)
            val user = User(id = 1, name = "John Doe") // User is a data class.
            
            val moshi = Moshi.Builder().build()
            val jsonAdapter = moshi.adapter(User::class.java
            How to serialize an Object to Map by Moshi
            Lines of Code : 7dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            Moshi moshi = new Moshi.Builder().build();
            
            JsonAdapter adapter = moshi.adapter(Object.class);
            
            Object jsonStructure = adapter.toJsonValue(obj);
            Map jsonObject = (Map) jsonStructure;
            
            Moshi parsing with InputStream
            Lines of Code : 25dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            private val moshi by lazy {
                Moshi.Builder().build()
            }
            
            private val adapter by lazy {
                moshi.adapter(Layout::class.java)
            }
            
            fun AssetManager.layoutsFromJson(jsonFile: String): List {
                val layouts = mutableListOf()
                JsonReader.o
            How to make JSON annotation of Moshi case insensitive in Android
            Javadot img7Lines of Code : 30dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            public static final class GetConversationListResponseBody {
              public final String email;
            
              GetConversationListResponseBody(String email) {
                this.email = email;
              }
            }
            
            static final class InternalGetConversationListResponseBody {
              Strin
            Json parsing with moshi
            Lines of Code : 4dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            val moshi = Moshi.Builder()
                                .add(KotlinJsonAdapterFactory())
                                .build()
            
            Broken server response handling with Moshi
            Lines of Code : 9dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            Moshi moshi = new Moshi.Builder()
                .add(DefaultOnDataMismatchAdapter.newFactory(Teacher.class, null))
                .build();
            
            JsonAdapter adapter = moshi.adapter(Teacher.class);
            
            Teacher teacher = adapter.fromJson(json);
            // teacher == null
            
            Android Moshi JsonAdapter for array's of objects
            Lines of Code : 41dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            public class ServletsResponse{
            
            @Json(name = "sPK")
            private Integer sPK;
            @Json(name = "sName")
            private String sName;
            @Json(name = "cFlag")
            private Integer cFlag;
            
            public Integer getSPK() {
            return sPK;
            }
            
            public void setSPK(Integer sPK) {
            t

            Community Discussions

            QUESTION

            Platform class java.util.Currency requires explicit JsonAdapter to be registered
            Asked 2022-Apr-10 at 05:44

            Getting error while using Moshi code gen for data class with Currency.

            Referred similar questions. (Adding referred question at the end)

            Error

            Caused by: java.lang.IllegalArgumentException: Platform class java.util.Currency requires explicit JsonAdapter to be registered

            Moshi Builder

            ...

            ANSWER

            Answered 2022-Apr-10 at 05:44

            I was able to figure out the issue.

            The root cause was the default AmountJsonAdapter created by Moshi was not internally using the CurrencyJsonAdapter.

            Changes required,
            1. Create custom JSON adapter for Amount rather than Currency.
            2. Add AmountJsonAdapter() instead of CurrencyJsonAdapter() in Moshi.Builder().
            3. Disable moshi adapter generation for Amount.
            After changes,

            Moshi Builder

            Source https://stackoverflow.com/questions/71811182

            QUESTION

            What is the right way to post with retrofit 2 and moshi
            Asked 2022-Apr-03 at 06:24

            I've been trying to make a POST with Retrofit 2 and Moshi but I've been unable to get it to work. My data classes look like this:

            ...

            ANSWER

            Answered 2022-Apr-03 at 06:24

            In postman, you are sending data in the body of the request. But in your code, it is going as key-value params. Try to send it in the body from your code. Try below snippet.

            Update your Order Data class:

            Source https://stackoverflow.com/questions/71721661

            QUESTION

            moshi: parsing a json response from okhttp3
            Asked 2022-Mar-31 at 08:46
            {
              "query": {
                "project": "all",
                "images": [
                  "dc5f659df9a4bcf90fc109830564d821"
                ],
                "organs": [
                  "leaf"
                ],
                "includeRelatedImages": true
              },
              "language": "en",
              "preferedReferential": "the-plant-list",
              "bestMatch": "Hibiscus rosa-sinensis L.",
              "results": [
                {
                  "score": 0.92912,
                  "species": {
                    "scientificNameWithoutAuthor": "Hibiscus rosa-sinensis",
                    "scientificNameAuthorship": "L.",
                    "genus": {
                      "scientificNameWithoutAuthor": "Hibiscus",
                      "scientificNameAuthorship": "",
                      "scientificName": "Hibiscus"
                    },
                    "family": {
                      "scientificNameWithoutAuthor": "Malvaceae",
                      "scientificNameAuthorship": "",
                      "scientificName": "Malvaceae"
                    },
                    "commonNames": [
                      "Hawaiian hibiscus",
                      "Hibiscus",
                      "Chinese hibiscus"
                    ],
                    "scientificName": "Hibiscus rosa-sinensis L."
                  },
                  "images": [
                    {
                      "organ": "leaf",
                      "author": "Tela Botanica − Antoine AFFOUARD",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1413870558000,
                        "string": "October 21, 2014"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/1d562e3be39e3297e6bdcff60d5f7d3fabe04eef",
                        "m": "https://bs.plantnet.org/image/m/1d562e3be39e3297e6bdcff60d5f7d3fabe04eef",
                        "s": "https://bs.plantnet.org/image/s/1d562e3be39e3297e6bdcff60d5f7d3fabe04eef"
                      },
                      "citation": "Tela Botanica − Antoine AFFOUARD / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "Antonio Sánchez Morales",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1548682043000,
                        "string": "January 28, 2019"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/3abd84f086c90ed70306d950532f4e165f681bfe",
                        "m": "https://bs.plantnet.org/image/m/3abd84f086c90ed70306d950532f4e165f681bfe",
                        "s": "https://bs.plantnet.org/image/s/3abd84f086c90ed70306d950532f4e165f681bfe"
                      },
                      "citation": "Antonio Sánchez Morales / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "femenia mayra",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1601041463219,
                        "string": "September 25, 2020"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/caa5ddc33d4b0b482b8c9f8ff8e0ba850d9af07f",
                        "m": "https://bs.plantnet.org/image/m/caa5ddc33d4b0b482b8c9f8ff8e0ba850d9af07f",
                        "s": "https://bs.plantnet.org/image/s/caa5ddc33d4b0b482b8c9f8ff8e0ba850d9af07f"
                      },
                      "citation": "femenia mayra / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "Antonio Sánchez Morales",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1544800115000,
                        "string": "December 14, 2018"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/8e2c190839ebbb1bb6ab7dd26cc413bb001080f4",
                        "m": "https://bs.plantnet.org/image/m/8e2c190839ebbb1bb6ab7dd26cc413bb001080f4",
                        "s": "https://bs.plantnet.org/image/s/8e2c190839ebbb1bb6ab7dd26cc413bb001080f4"
                      },
                      "citation": "Antonio Sánchez Morales / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "ire110",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1599948160933,
                        "string": "September 12, 2020"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/394caf62b3ce20c47f005d425488806f138a8493",
                        "m": "https://bs.plantnet.org/image/m/394caf62b3ce20c47f005d425488806f138a8493",
                        "s": "https://bs.plantnet.org/image/s/394caf62b3ce20c47f005d425488806f138a8493"
                      },
                      "citation": "ire110 / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "Andreas Vogelsinger",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1579618800636,
                        "string": "January 21, 2020"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/cc9f39d17007bb5fd36b890cf0043a0a683352be",
                        "m": "https://bs.plantnet.org/image/m/cc9f39d17007bb5fd36b890cf0043a0a683352be",
                        "s": "https://bs.plantnet.org/image/s/cc9f39d17007bb5fd36b890cf0043a0a683352be"
                      },
                      "citation": "Andreas Vogelsinger / Pl@ntNet, cc-by-sa"
                    }
                  ],
                  "gbif": {
                    "id": "3152559"
                  }
                },
                {
                  "score": 0.03652,
                  "species": {
                    "scientificNameWithoutAuthor": "Hibiscus schizopetalus",
                    "scientificNameAuthorship": "(Dyer) Hook.f.",
                    "genus": {
                      "scientificNameWithoutAuthor": "Hibiscus",
                      "scientificNameAuthorship": "",
                      "scientificName": "Hibiscus"
                    },
                    "family": {
                      "scientificNameWithoutAuthor": "Malvaceae",
                      "scientificNameAuthorship": "",
                      "scientificName": "Malvaceae"
                    },
                    "commonNames": [
                      "Campanilla",
                      "Chinese lantern",
                      "Japanese hibiscus"
                    ],
                    "scientificName": "Hibiscus schizopetalus (Dyer) Hook.f."
                  },
                  "images": [
                    {
                      "organ": "leaf",
                      "author": "nanni pri",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1619808048797,
                        "string": "April 30, 2021"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/4ca16c7045b6b2e56cbbc0f4afed08ddc3f556f7",
                        "m": "https://bs.plantnet.org/image/m/4ca16c7045b6b2e56cbbc0f4afed08ddc3f556f7",
                        "s": "https://bs.plantnet.org/image/s/4ca16c7045b6b2e56cbbc0f4afed08ddc3f556f7"
                      },
                      "citation": "nanni pri / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "sharlaine bustamants",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1591247217009,
                        "string": "June 4, 2020"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/c4722a732fef3bfd1eab6d6d80b500bb036e5215",
                        "m": "https://bs.plantnet.org/image/m/c4722a732fef3bfd1eab6d6d80b500bb036e5215",
                        "s": "https://bs.plantnet.org/image/s/c4722a732fef3bfd1eab6d6d80b500bb036e5215"
                      },
                      "citation": "sharlaine bustamants / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "Hugo SANTACREU",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1531233524000,
                        "string": "July 10, 2018"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/3ddba92c55e30e0cb70b10feb1cd021190dfec76",
                        "m": "https://bs.plantnet.org/image/m/3ddba92c55e30e0cb70b10feb1cd021190dfec76",
                        "s": "https://bs.plantnet.org/image/s/3ddba92c55e30e0cb70b10feb1cd021190dfec76"
                      },
                      "citation": "Hugo SANTACREU / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "Pierre Bonnet",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1534366939000,
                        "string": "August 15, 2018"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/f68ad5f10d76837924537d560cbb62b6cb4003c5",
                        "m": "https://bs.plantnet.org/image/m/f68ad5f10d76837924537d560cbb62b6cb4003c5",
                        "s": "https://bs.plantnet.org/image/s/f68ad5f10d76837924537d560cbb62b6cb4003c5"
                      },
                      "citation": "Pierre Bonnet / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "Tobias Jacobsen",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1571130043838,
                        "string": "October 15, 2019"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/44da8a021cfe8dcc1004a2998ff13982cce545f3",
                        "m": "https://bs.plantnet.org/image/m/44da8a021cfe8dcc1004a2998ff13982cce545f3",
                        "s": "https://bs.plantnet.org/image/s/44da8a021cfe8dcc1004a2998ff13982cce545f3"
                      },
                      "citation": "Tobias Jacobsen / Pl@ntNet, cc-by-sa"
                    },
                    {
                      "organ": "leaf",
                      "author": "abderrahim Lamari",
                      "license": "cc-by-sa",
                      "date": {
                        "timestamp": 1619785453625,
                        "string": "April 30, 2021"
                      },
                      "url": {
                        "o": "https://bs.plantnet.org/image/o/e669d09a54681d3d56fabfb588d3ecb50b523490",
                        "m": "https://bs.plantnet.org/image/m/e669d09a54681d3d56fabfb588d3ecb50b523490",
                        "s": "https://bs.plantnet.org/image/s/e669d09a54681d3d56fabfb588d3ecb50b523490"
                      },
                      "citation": "abderrahim Lamari / Pl@ntNet, cc-by-sa"
                    }
                  ],
                  "gbif": {
                    "id": "9064581"
                  }
                }
              ],
              "version": "2022-02-14 (5.0)",
              "remainingIdentificationRequests": 491
            }
            
            ...

            ANSWER

            Answered 2022-Mar-31 at 08:46

            Here I am sharing "Deserialize your JSON string into Java objects in four different ways". There are a lot of other java JSON libraries.

            1. Using Moshi

            2. Using Jackson

            3. Using Gson

            4. Using Genson

            "Remember - The POJOs in java are useful in defining objects to increase their readability and reusability."

            We'll use the following Root class with multiple fields as the object to deserialize throughout.

            Root.java

            Source https://stackoverflow.com/questions/71686565

            QUESTION

            Kotlin Retrofit Moshi POST request not working
            Asked 2022-Mar-24 at 11:42

            I am working on an app that interfaces with an API to select from and update a MySQL database.

            I am using Kotlin with Retrofit and the Moshi converter. (As I am new to learning all this stuff, this app is modified from the Mars Photo code on https://developer.android.com/courses/pathways/android-basics-kotlin-unit-4-pathway-2 .)

            I have successfully implemented the GET part in Retrofit thanks to building out from the above tutorial, but I am having a heck of a time POSTing to the database.

            The POST to update via the API works in Postman but I have tried multiple ways to replicate that in my app without success. I have tried a pretty basic POST passing in my data object (as standard Kotlin vars as well as Json annotated or SerializedName annotated), and I have tried Formurlencoded with Fields and Multipart with Parts.

            I am including what I hope is all the relevant code (the latest attempt, at least). Thanks for any assistance!

            ...

            ANSWER

            Answered 2022-Mar-24 at 11:42

            Normally you create your @Body classes as :

            Source https://stackoverflow.com/questions/71600457

            QUESTION

            SocketException: java.net.SocketException: socket is closed release build
            Asked 2022-Mar-02 at 18:36

            We are having problems with Android network requests, to be more exact receiving random

            ...

            ANSWER

            Answered 2022-Feb-25 at 10:33

            You can add code below to pro-guard file:

            Source https://stackoverflow.com/questions/70877944

            QUESTION

            Jetpack Compose + Navigation - Infinite loop on navigate()
            Asked 2022-Feb-22 at 17:35

            I'm using Jetpack Compose + Navigation (Single Activity, no Fragments) and i'm trying to perform a navigation route as follow:

            SplashScreen ---(delay)---> AuthScreen ---(if successful)--> MainScreen

            Unfortunately, when i perform Login, the function navigate() in the LoginScreen composables causes an infinite loop. I don't understand if i'm triggering recomposition or what happens. Unfortunately, it's hard to share all the code, but keep in mind that:

            • the issue doesn't seem to be related to LoginScreen and MainScreen composables (you can assume them to be just a simple Text composable)
            • It doesn't seem to be related to NavigationGraph too. Infact, if i just make the SplashScreen --> MainScreen transition there is no problem occurring
            • If i remove the line navController.navigate("main") there is no more loop;
            • The code is based (almost copy-paste) of this example

            This is the AuthScreen code where the issue occurs.

            ...

            ANSWER

            Answered 2022-Feb-22 at 17:35

            It's because you're trying to navigate from a composable. See the documentation

            You should only call navigate() as part of a callback and not as part of your composable itself, to avoid calling navigate() on every recomposition.

            You could use a LaunchEffect for instance

            Source https://stackoverflow.com/questions/71225637

            QUESTION

            One or more issues found when checking AAR metadata values:
            Asked 2022-Feb-18 at 17:01

            Hey I am trying to run my application and I am getting this error

            build.gradle

            ...

            ANSWER

            Answered 2021-Nov-19 at 06:20

            Dependency: androidx.lifecycle:lifecycle-runtime-ktx:2.4.0. The issue is with this dependency, there may be some transitive dependency error. I would suggest use the alpha version of this dependency, worked for me. Replace with this dependency : androidx.lifecycle:lifecycle-*:2.4.0-alpha03

            Source https://stackoverflow.com/questions/69943549

            QUESTION

            Deserialize JSON with "non-stable" values using kotlin serialization
            Asked 2022-Feb-01 at 11:06

            I have not very well structured JSON from BE (that I cannot change) which was formerly handled with moshi (custom adapter for the issue). Now I am trying to use pure kotlin serialization instead, but as said, JSON structure doesn't help me much.

            ...

            ANSWER

            Answered 2022-Feb-01 at 11:06

            Having classDiscriminator is not a mandatory requirement for polymorphic deserialization. You can use content-based polymorphic deserialization in this case.

            All you need is to define a JsonContentPolymorphicSerializer for Values class with some logic for exact subclass serializer selection:

            Source https://stackoverflow.com/questions/70938379

            QUESTION

            Kotlin 1.6.0 breaks proguard?
            Asked 2022-Jan-31 at 10:09

            After updating my Android app from Kotlin 1.5.21 to Kotlin 1.6.0, my proguard rules stopped working (i.e. they are ignored). This caused some reflection code to break on release mode. Downgrading to Kotlin 1.5.21 fixes the problem.

            Are there any known problems with Kotlin 1.6.0 and proguard ?

            Googling around, I see that there are other related problems (see this, this, this).

            ...

            ANSWER

            Answered 2022-Jan-31 at 10:09

            The problem was the version of R8 bundled with the Android Gradle Plugin (AGP).

            Following the advice in this related answer, I explicitly set com.android.tools:r8:3.0.77 in my gradle configuration file.

            Source https://stackoverflow.com/questions/70569804

            QUESTION

            I'm using dagger2 ,while genrating signed apk ,retrofit api calls are not working, in debug mode its working fine
            Asked 2022-Jan-31 at 07:38

            Retrofit and moshi-kotlin Api's are not working in android. I'm using dagger2 ,while genrating signed apk ,retrofit api calls are not working, in debug mode its working fine . while we enabled minifyenable true and shrinkresource true. @JsonClass(generateAdapter = true) @SuppressLint("ParcelCreator") @Keep data class DashboardListRes( @Json(name = "data") vardata: List?=ArrayList(), @Json(name = "lead_data") var leadData: LeadData= LeadData(), @Json(name = "message") var message: String="", @Json(name = "status") var status: String="", @Json(name = "status_code") var statusCode: Int=0, @Json(name = "user") var user: User=User() ):Serializable

            1. 2. -keepattributes Signature, InnerClasses, EnclosingMethod

            ...

            ANSWER

            Answered 2022-Jan-31 at 07:38

            If you are converting the data received into a POJO object using some built in function and then populating a data class or something, you need to make sure you exclude the data classes from proguard.

            What I generally do is I put all my data classes in one package and then exclude everything in that package like so:

            Source https://stackoverflow.com/questions/70909024

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install moshi

            Download [the latest JAR][dl] or depend via Maven:. Snapshots of the development version are available in [Sonatype’s snapshots repository][snap].

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
            Maven
            Gradle
            CLONE
          • HTTPS

            https://github.com/square/moshi.git

          • CLI

            gh repo clone square/moshi

          • sshUrl

            git@github.com:square/moshi.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular JSON Processing Libraries

            json

            by nlohmann

            fastjson

            by alibaba

            jq

            by stedolan

            gson

            by google

            normalizr

            by paularmstrong

            Try Top Libraries by square

            okhttp

            by squareKotlin

            retrofit

            by squareJava

            leakcanary

            by squareKotlin

            picasso

            by squareKotlin

            javapoet

            by squareJava