> For the complete documentation index, see [llms.txt](https://darwin-framework.gitbook.io/dogs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://darwin-framework.gitbook.io/dogs/concepts/converters.md).

# Converters

Converters are first level serializers which convert an unserialized value into to a graph representation. Custom converter implementations can be linked via `@LinkSerializer()`. By default, all converters are associated with their type argument. This behaviour can be disabled by specifying `isAssociated` in the super constructor.

{% hint style="success" %}
Converters must only be able to serialize single instances. Common collections will be automatically handled by the DOG engine.
{% endhint %}

Following converters are registered by default.\
(Primitive types can be converted without the need for a converter)

| Converter Name           | Serialized Type                        |
| ------------------------ | -------------------------------------- |
| PolymorphicConverter     | dynamic, Object (not associated)       |
| DefaultIterableConverter | Iterable\<dynamic> (not associated)    |
| DefaultListConverter     | List\<dynamic> (not associated)        |
| DefaultSetConverter      | Set\<dynamic> (not associated)         |
| DefaultMapConverter      | Map\<dynamic,dynamic> (not associated) |
| DateTimeConverter        | DateTime[^1]                           |
| DurationConverter        | Duration[^2]                           |
| UriConverter             | Uri[^3]                                |
| Uint8List                | Uint8List[^4]                          |

## Polymorphism

Dog supports first level polymorphism for all data types which are either primitive or have a registered [Structures](/dogs/concepts/structures.md). Complex types are identified by a added `_type` property in the resulting DogMap. Complex types which are serialized to a graph value which is not a map are expanded into a map containing the type in `_type` and the converted value in `_value`. Properties can be marked as polymorphic by tagging the fields with `@Polymorphic()`.

[^1]: Converted to an ISO-8601 string

[^2]: Converted to a millisecond interval represented by a int

[^3]: Converted to a uri string

[^4]: Converted to a base64 string
