Moshi
A modern JSON library for Kotlin and Java. (by square)
Gson
A Java serialization/deserialization library to convert Java Objects into JSON and back (by google)
Our great sponsors
Moshi | Gson | |
---|---|---|
17 | 26 | |
9,465 | 22,901 | |
0.8% | 0.6% | |
8.6 | 9.1 | |
3 days ago | 1 day ago | |
Kotlin | Java | |
Apache License 2.0 | Apache License 2.0 |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Moshi
Posts with mentions or reviews of Moshi.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-04-14.
-
Kotlin DSL is Now the Default for New Gradle Builds
Honestly, when you look at a build.gradle.kts written by someone who knows what they're doing, it's not that bad (that reminds me, I should really clean up the build.gradle.kts on my personal project, I haven't heavily edited it since I knew a lot less about gradle...). For example, here's the build.gradle.kts for Moshi, a JSON serialization library from Square. It uses the root build.gradle.kts for the project a bit, which is here. The root one is a little more complex, but that's mostly because it has to deal with a multi-release build and has to configure a few plugins, like dokka. (If you're wondering where all the library versions are, they're here, using a new feature in Gradle you might like: The version catalog)
-
Modern Android Development in 2023
Moshi
-
Why don't you write unit tests and integration tests to ksp project
This approach is also used by square/moshi. You can also refer this.
-
Apple's Swift rewrite of its Foundation framework will be open source
Best practice in Android would be Moshi, which is written by many of the same authors as Gson but is still actively maintained. It's more or less a breaking upgrade from Gson.
-
Soursop and Ponies in Kona: A C++ Committee Trip Report
Java annotations have enabled compile-time reflection since Java 1.6, and of course it has been used for serialization: https://github.com/square/moshi/#codegen
-
What are the most common used (3rd party) libraries and frameworks used in Android development?
JSON de/serialization: Kotlin serialization, Moshi
-
Help parsing JSON with Retrofit & Moshi
However i am getting an error "Expected BEGIN-ARRAY but was BEGIN-OBJECT at $". Looking over the moshi documentation (https://github.com/square/moshi) I think I need to use an adapter as my JSON response starts with "{ }" not the expected "[ ]". I am just struggling to understand how to implement the adapter as I think the built in adapter should work.
-
Release Kotlin 1.6.0 · JetBrains/kotlin
Moshi users are currently blocked to update until Moshi 1.13.0 is released: https://github.com/square/moshi/issues/1368
-
No Good Deed Goes Unpunished
I estimated it would take me half a day to complete. I thought it would be a couple of import statement changes and some variable renaming because our app already was using Moshi, another JSON parsing library, and we had already deprecated GSON. I was wrong. The project ended up taking 5 weeks off and on, produced a 3k line code diff, and upon release, it immediately crashed the Reddit Android App. After a quick hotfix, I finally eliminated the last remnants of GSON and made Reddit more stable.
-
Google SignIn Compose
Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects
Gson
Posts with mentions or reviews of Gson.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2024-03-04.
-
Data API for Amazon Aurora Serverless v2 with AWS SDK for Java - Part 3 Executing update and insert SQL statements in batch
In this concrete example we'll create 3 products. We can then convert this JSON to the list of products using Gson.
-
The Newest Java Json Benchmark Results just dropped
Gson has been in maintenance mode for at least 6 years. It's kind of a shame, because the API and implementation were a lot cleaner than Jackson.
-
How We Built a Serverless Backend Using GraalVM, AWS Lambda and Astra DB (Part 2)
For more information on native-image build arguments, please consult the GraalVM Native Image Options documentation. The next listing contains the contents of reflect.json, which contains a bunch of data classes that we need to serialize and deserialize with Gson, as well as our Lambda handler class which the runtime needs to instantiate based on the qualified class name passed to the Lambda function.
-
How to Make Java MRZ Detector with Dynamsoft Label Recognizer for Windows and Linux
The loadModel() method is special. It needs to dynamically update the model path specified in the JSON-formatted template file according to the extraction path of the Jar package. Gson can be used to load and update the JSON object.
-
Removies
gson
-
Finding Luke through the command line by consuming an API
The Gson library could parse the string response to a JSON.
-
How to Parse or fetch this nested Json object in android studio from Json assets file?
This library works very well. https://github.com/google/gson
-
Backend Developer Learning Path 2021
GSON
-
How to package a function + arguments for remote execution (without RMI)?
(but tbh I would definitely suggest looking into Gson)
-
Need help with planning a GUI project for my finals
However, I do know that there isn't an inbuilt JSON parser within Java. So, you will need to include a third-party JSON parser library within your project. I've had experience with using gson for doing this myself, and that library is also rather easy to use.
What are some alternatives?
When comparing Moshi and Gson you can also consider the following projects:
Jackson - Core part of Jackson that defines Streaming API as well as basic shared abstractions
kotlinx.serialization - Kotlin multiplatform / multi-format serialization
Jackson JSON Processor - Main Portal page for the Jackson project
jsoniter - jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Genson - Genson a fast & modular Java <> Json library
ktor-moshi - Ktor feature that adds Moshi JSON serialization support
Yasson - Eclipse Yasson project
LoganSquare - Screaming fast JSON parsing and serialization library for Android.
JSON-io - Convert Java to JSON. Convert JSON to Java. Pretty print JSON. Java JSON serializer.