com.riversoft.weixin.common.util.BooleanSerializer Maven / Gradle / Ivy
package com.riversoft.weixin.common.util;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
/**
* Created by exizhai on 9/26/2015.
*/
public class BooleanSerializer extends JsonSerializer {
@Override
public void serialize(Boolean aBoolean, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeNumber(aBoolean ? 1 : 0);
}
}