How to pretty print JSON using Moshi

This article shows how to use Moshi’s JsonAdaptor indent method to enable the pretty print JSON. Table of contents: 1. Download Moshi 2. Compact print JSON (Default) 3. Pretty print JSON using Moshi 4. Download Source Code 5. References P.S Tested with Moshi 1.15.1 1. Download Moshi Declare moshi in the pom.xml. pom.xml <dependency> <groupId>com.squareup.moshi</groupId> …

Read more

Moshi – java.math.BigDecimal requires explicit JsonAdapter to be registered

Moshi does not have built-in adapters to process types like java.math.BigDecimal; we need to manually provide a custom adapter to handle the BigDecimal type. Table of contents: 1. Download Moshi 2. BigDecimal requires explicit JsonAdapter 3. Make Moshi supports BigDecimal 3.1 Define BigDecimal Adapter 3.2 Register the Adapter with Moshi 4. Download Source Code 5. …

Read more