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 (​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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.