Fast, Easy-to-use and Customizable Java object to text serialization

Latest stable version : Odin-1.2.d

Use for data storage

Odin can serialize all types of objects fast and efficiently without the need of configuration or code modification.

The odn format contains 3 types of entries to provide a simple export even for complex objects like Map.

id = "084aed6d-62f0-4196-a7d2-04f0c1e69cb6"
map int string = {
    5 : "value for 5"
    10 : "value for 10"

Odin comes with the possibility to indent or compress the output result, both modes use the same reader.

{description="In short format line breaks are escape",version=1}

Use for configuration files

Use the default Odin elements to read and write configuration files of your application.

The odn format manages comments and blank lines in order to create an easy to read export.

# Empty lines can be inserted between or around comments
activated = true
contents = {
    # Comments and blank lines are kept during the rewriting
    text = "
        Odin can also read and write
        Multilines String like this
        containing two \n

Manage generic types

The strategy of Odn is to always know the object instance type, so you can write an object containing abstract or parameterized field types and get the right object type on deserialization.

Basically, when generic type and object type do not match, Odin writes an additional tag with the type name. This type can also be a registered alias to make it easier to read.

    # Field declaration : private Object date;
    date = <local datetime> "2018-02-25 21:05:30"
    # Field declaration : private AbstractObject<LocalDateTime> anObject;
    # AbstractObject contains one field ( T value )
    anObject = <com.newpixelcoffee.odin.AnObject> {
        value = "2018-02-25 21:05:30"

A powerful Java library

Odin offers many ways to serialize and deserialize objects and different customization possibilities.

  • Serialize or deserialize objects in one line

  • Handle bidirectional and hierarchical references

  • Adapters to create custom serializations

  • Annotations to rename or comment class fields

  • Annotations to change a field adapter


dependencies {
    implementation 'com.newpixelcoffee.odin:odin:1.2.+'
Manual download

The version is composed as follows: major.minor.internal

An internal change can be a performance improvement or a fix.

Documentation Changelog Report an issue