[id='custom_marshallers']
= Using Custom Marshallers
{brandname} provides a `Marshaller` interface that you can implement for custom marshallers.

.Procedure

. Implement the `Marshaller` interface.
. Configure {brandname} to use your marshaller.
. Add your Java classes to the deserialization allowlist.

* Programmatically:
+
[source,java]
----
include::code_examples/CustomMarshaller.java[]
----

* Declaratively:
+
[source,xml,options="nowrap",subs=attributes+]
----
include::config_examples/custom_marshaller.xml[]
----

[TIP]
====
Custom marshaller implementations can access a configured white list via the
link:{javadocroot}/org/infinispan/commons/marshall/Marshaller.html#initialize(org.infinispan.commons.configuration.ClassWhiteList)[initialize()] method, which is called during startup.
====

.Reference

* link:{javadocroot}/org/infinispan/commons/marshall/Marshaller.html[org.infinispan.commons.marshall.Marshaller]
* link:#deserialization_allowlist-marshallers[Adding Java Classes to Deserialization Allow Lists]
