[id='using-custom-marshallers_{context}']
= Using custom marshallers
{brandname} provides a `Marshaller` interface that you can implement for custom marshallers.

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

.Procedure

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

.Declarative
[source,xml,options="nowrap",subs=attributes+,role="primary"]
----
include::config_examples/custom_marshaller.xml[]
----

.Programmatic
[source,java,options="nowrap",subs=attributes+,role="secondary"]
----
include::code_examples/CustomMarshaller.java[]
----

[role="_additional-resources"]
.Additional resources
* link:{javadocroot}/org/infinispan/commons/marshall/Marshaller.html[org.infinispan.commons.marshall.Marshaller]
