Make a class encodable into JSON format.