# Serialization

Serialization is straightforward: we serialize each parameter to JSON, send it, and then deserialize it on the receiving end. For more information on this process, check out the [JSON.net documentation](https://www.newtonsoft.com/json/help/html/Introduction.htm).

> Since M*essenger* uses json serialization, custom class references are supported as well!\
> `Messenger.ToServer(MyMessage, MyCustomClass);`

If you want to see how Messenger utilizes JSON serialization, take a look at the `Messenger.Serialization.cs` class.

There are also examples in the samples folder itself, please go to the [samples page](https://jrcooler.gitbook.io/easy-multiplayer/samples#messengersamplecomplex.cs) for more explanation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jrcooler.gitbook.io/easy-multiplayer/messenger/serialization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
