import java.io.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import org.springframework.boot.jackson.*;
//@JsonComponent
public class Example {
public static class Serializer extends JsonSerializer<String> {
@Override
public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
System.out.println("Example.................................................111[" + s + "]");
jsonGenerator.writeString(s);
}
// ...
}
public static class Deserializer extends JsonDeserializer<String> {
@Override
public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
System.out.println("Example.................................................222[" + jsonParser.getText() + "]");
jsonParser.getValueAsString("accessPartyInfo");
return jsonParser.getText();
}
// ...
}
}
-------------
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonDeserialize(using = Example.Deserializer.class)
@ApiModelProperty(value = "接入方信息")
private JSONArray accessPartyInfo;