@Override
    public void serializeWithType(final X509CertificateCredential value, final JsonGenerator generator,
                                  final SerializerProvider serializers, final TypeSerializer typeSer) throws IOException {
        try {
            serializers.setAttribute("WithType", Boolean.TRUE);
            typeSer.writeTypePrefix(generator, typeSer.typeId(value, JsonToken.START_OBJECT));
            serialize(value, generator, serializers);
            typeSer.writeTypeSuffix(generator, typeSer.typeId(value, JsonToken.START_OBJECT));
        } finally {
            serializers.setAttribute("WithType", Boolean.FALSE);
        }
    }
This is {@link X509CertificateCredentialJsonSerializer}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-x509-core/src/main/java/org/apereo/cas/adaptors/x509/util/X509CertificateCredentialJsonSerializer.java