[id='clients-marshalled-objects_{context}']
= Clients and marshalled objects

When you configure Hot Rod Java clients to use a marshaller, you must configure your cache with the encoding for that marshaller.

Each marshaller uses a different media type to produce `byte[]` content that the client can transmit to {brandname} Server.
When reading from the server, the client marshaller performs the opposite operation, using the media type to produce data from `byte[]` content.

Your cache encoding must be compatible with the Hot Rod client marshaller.
For example, if you configure a cache encoding as `application/x-protostream`, you can use the ProtoStream marshaller with your clients to operate on that cache.
However if the client marshaller uses an encoding that {brandname} cannot convert to and from `application/x-protostream`, {brandname} throws an error message.

If you use `JavaSerializationMarshaller` or `GenericJBossMarshaller` you should encode caches with the `application/x-java-serialized-object` or `application/x-jboss-marshalling` media type, respectively.

.ProtoStream to JSON conversion

{brandname} converts keys and values encoded with the `application/x-protostream` media type to `application/json`.

This allows REST clients to include the JSON media type in request headers and perform operations on caches that use ProtoStream encoding:

* `Accept: application/json` for read operations.
* `Content-Type: application/json` for write operations.
