For the More Curious: Alternate Parsers and Data Formats

Gson is a popular parser for JSON, but it is not the only one you can use. Moshi (github.com/​square/​moshi) is another popular library from Square that also handles parsing JSON data. Moshi borrows some ideas from Gson and attempts to make them faster and more efficient. Square created a converter for Moshi so that it can work directly with Retrofit.

Retrofit does not limit you to just using JSON as your data format. You can also use XML or even Protobufs, if you want. There are many serialization libraries available for Retrofit, so you can use the one that best fits your data transfer configuration.

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.