[android] How do you save/store objects in SharedPreferences on Android?

I've used jackson to store my objects (jackson).

Added jackson library to gradle:

api 'com.fasterxml.jackson.core:jackson-core:2.9.4'
api 'com.fasterxml.jackson.core:jackson-annotations:2.9.4'
api 'com.fasterxml.jackson.core:jackson-databind:2.9.4'

My test class:

public class Car {
    private String color;
    private String type;
    // standard getters setters
}

Java Object to JSON:

ObjectMapper objectMapper = new ObjectMapper();
String carAsString = objectMapper.writeValueAsString(car);

Store it in shared preferences:

preferences.edit().car().put(carAsString).apply();

Restore it from shared preferences:

ObjectMapper objectMapper = new ObjectMapper();
Car car = objectMapper.readValue(preferences.car().get(), Car.class);