square

square/moshi

Kotlin Apache-2.0 Dev Tools

A modern JSON library for Kotlin and Java.

10.1k stars
806 forks
active
GitHub +1 / week

10.1k

Stars

806

Forks

106

Open issues

30

Contributors

AI Analysis

Moshi is a modern JSON serialization/deserialization library for Kotlin and Java that converts between JSON strings and strongly-typed objects. It is designed for Android, Java, and Kotlin applications and serves developers who need efficient, type-safe JSON parsing with support for custom adapters and code generation. Not a general-purpose tool—specialized for the JVM ecosystem.

Dev Tools Library Discovery value: 3/10
Documentation 8/10
Activity 10/10
Community 9/10
Code quality 5/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

json-serialization kotlin-java type-adapters android data-binding
Actively maintained Well documented Popular Niche/specialized use case Beginner friendly Production ready
Deep Analysis · Based on README and public signals
2w ago

Square's Moshi: A mature, Kotlin-first JSON library with a decade of Android production use

Moshi is a JSON serialization/deserialization library for Android, Java, and Kotlin, created by Square in 2014. It targets Android and JVM developers who want a type-safe, extensible alternative to Gson, with first-class Kotlin support via code generation (kapt/KSP) or reflection. Its key differentiation is a clean adapter model, explicit null handling, and tight integration with Square's broader ecosystem (OkHttp, Retrofit). It is widely used in Android development and has a loyal installed base, though Kotlin Multiplatform projects increasingly favor kotlinx.serialization.

Origin

Created by Square in August 2014 as a cleaner alternative to Gson, Moshi evolved from a Java-centric library to a Kotlin-first one, adding KSP-based code generation and Kotlin data class support as Android development shifted to Kotlin.

Growth

Moshi grew on the coattails of Square's dominant Android networking stack (OkHttp + Retrofit). Its growth peaked around 2018–2021 as Android moved to Kotlin and Moshi added native Kotlin support. Star velocity has slowed to near zero recently, reflecting category maturity rather than decline — the library is widely installed and stable, not in a growth phase.

In production

Moshi has verifiable production usage at scale: it is the recommended JSON library in numerous Android codebases, widely referenced in Retrofit documentation and tutorials, and used within Square's own apps. Stack Overflow questions, GitHub dependency graphs, and Android blog posts confirm broad real-world use. Adoption is not speculative — it is a well-established library in the Android ecosystem.

Code analysis
Architecture

Appears to use a builder-pattern Moshi instance with a chain-of-responsibility adapter registry. Likely supports three modes: Java reflection, Kotlin reflection (via KotlinJsonAdapterFactory), and compile-time code generation (KSP). Custom adapters use @ToJson/@FromJson annotations. Architecture appears modular, separating core, kotlin, adapters, and codegen artifacts.

Tests

Not documented in README

Maintenance

Last push was June 19, 2026 — approximately 7 days before the evaluation date — indicating active maintenance. The project has 805 forks and 10,141 stars accumulated over a decade. Slow star accumulation in recent weeks reflects market saturation, not neglect. Square continues to maintain it alongside their broader OSS portfolio.

Honest verdict

ADOPT IF: you are building an Android or JVM-only Kotlin/Java application and want a battle-tested JSON library with strong Kotlin data class support, a clean custom adapter model, and deep integration with Retrofit/OkHttp. AVOID IF: you are starting a Kotlin Multiplatform project or need JSON serialization across non-JVM targets — kotlinx.serialization is a better fit there. MONITOR IF: you have an existing Moshi codebase and are considering migration to kotlinx.serialization; the migration cost is real and likely not justified unless you need KMP.

Independent dimensions

Mainstream potential

4/10

Technical importance

7/10

Adoption evidence

8/10

Risks
  • No Kotlin Multiplatform support limits adoption in the KMP ecosystem, which is growing rapidly and drawing new Kotlin projects away from JVM-only libraries.
  • JetBrains actively promotes kotlinx.serialization as the canonical Kotlin serialization solution, which may reduce Moshi's mindshare among developers starting new Kotlin projects.
  • Star growth has effectively stalled, suggesting the library is past its adoption growth phase. Continued maintenance is likely but major new features or ecosystem expansion appear unlikely.
  • Reflection-based usage on Kotlin classes is explicitly unsupported, requiring developers to add codegen (kapt/KSP) or KotlinJsonAdapterFactory — this adds build configuration complexity compared to simpler alternatives.
  • Square's OSS portfolio is large; there is a non-zero risk of reduced investment if internal usage at Square shifts toward KMP or other stacks, though no public signals of this exist currently.
Prediction

Moshi will remain actively maintained and widely used in existing Android codebases for years. New project adoption will likely continue declining slowly as kotlinx.serialization captures KMP and new-project mindshare, but Moshi's installed base is too large to disappear soon.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

Kotlin
59.3%
Java
40.7%

Information

Language
Kotlin
License
Apache-2.0
Last updated
14h ago
Created
145mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Recent releases

No releases published yet.

Similar repos

Kotlin

Kotlin/kotlinx.serialization

Kotlin multiplatform serialization library providing reflectionless,...

5.9k Kotlin
square

square/okio

Okio is a modern I/O library for Android, Java, and Kotlin Multiplatform that...

9k Kotlin Dev Tools
square

square/okhttp

OkHttp is Square's production-grade HTTP client library for the JVM, Android,...

47k Kotlin Dev Tools
mongodb

mongodb/mongo-java-driver

The official MongoDB driver for Java, Kotlin, and Scala on the JVM, providing...

2.7k Java Data
google

google/gson

Gson is a mature Java library for bidirectional JSON...

24.2k Java
vs. alternatives
google/gson

Gson is older and more widely known historically but has been in maintenance-only mode since ~2022. Moshi has better Kotlin support, stricter null safety, and more active development. Gson still has a larger raw install base due to legacy projects.

Kotlin/kotlinx.serialization

The primary alternative for new Kotlin projects, especially Kotlin Multiplatform. It is JetBrains-backed, requires no reflection, and works on all KMP targets. For Android-only or JVM projects, the two are roughly equivalent; for KMP, kotlinx.serialization is the clear default. Moshi has no KMP support.

square/okhttp

Not a direct competitor — OkHttp is an HTTP client. Mentioned as context: Moshi integrates naturally as the serialization layer in the OkHttp/Retrofit stack, which is a key adoption driver.

Jackson (FasterXML)

Jackson is more feature-complete for complex enterprise Java use cases (streaming, tree model, data binding, XML). Moshi is lighter and more focused. For Android, Moshi's smaller footprint and cleaner API are advantages; for complex backend Java workloads, Jackson is likely preferred.

kyutai-labs/moshi

Unrelated project sharing the name — it is a Python-based speech/audio model. No technical relationship to square/moshi.