Skip to main content
Restate sends data over the network for storing state, journaling actions, awakeables, etc. Therefore, Restate needs to serialize and deserialize the journal entries.

Default serialization

The SDK uses by default Jackson Databind for the Java API, and Kotlinx serialization for the Kotlin API. For example, for state keys:
The same applies to journaling actions, awakeables, etc.

Customizing serialization

There are different entrypoints in the SDK to customize (de)serialization, depending on your needs.

Custom Jackson ObjectMapper

You can customize the Jackson’s ObjectMapper by subclassing the JacksonSerdeFactory class:
And annotating your services with @CustomSerdeFactory:

Custom Kotlinx Serialization Json

You can customize the Kotlinx Serialization Json by subclassing the KotlinSerializationSerdeFactory class:
And annotating your services with @CustomSerdeFactory:

Use custom serializer for a specific operation

If you need for a specific operation (e.g. for Context.run or Context.Awakeable) a custom (de)serializer, you can implement one using the interface Serde:
And then use it, for example, in combination with ctx.run:

Use another serialization library

If you want to use a different serialization library throughout your service, we suggest implementing SerdeFactory and annotating the service class with @CustomSerdeFactory. Refer to the Javadocs for more details.