{"id":15069188,"url":"https://github.com/aeckar/hass","last_synced_at":"2026-01-24T05:36:46.849Z","repository":{"id":237575447,"uuid":"794831746","full_name":"aeckar/hass","owner":"aeckar","description":"Runtime binary serialization for Kotlin/JVM","archived":false,"fork":false,"pushed_at":"2024-06-14T21:41:09.000Z","size":914,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-14T22:44:51.529Z","etag":null,"topics":["binary","easy-to-use","input-output","java-interop","jvm","reflection","serialization"],"latest_commit_sha":null,"homepage":"https://aeckar.github.io/hass/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aeckar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-02T03:33:44.000Z","updated_at":"2024-06-14T22:44:56.366Z","dependencies_parsed_at":"2024-05-30T05:02:12.517Z","dependency_job_id":"0ed041fa-4af4-4017-85f0-e87ae4df5295","html_url":"https://github.com/aeckar/hass","commit_stats":null,"previous_names":["ladle-gh/kanary","aeckar/hass"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Fhass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Fhass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Fhass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeckar%2Fhass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aeckar","download_url":"https://codeload.github.com/aeckar/hass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219854983,"owners_count":16556179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary","easy-to-use","input-output","java-interop","jvm","reflection","serialization"],"created_at":"2024-09-25T01:40:55.625Z","updated_at":"2025-11-01T19:30:23.051Z","avatar_url":"https://github.com/aeckar.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hass\n***H**eap-**A**llocated **S**erialization **S**chemas*\n\n[![JitPack: v1.0.0](https://jitpack.io/v/aeckar/hass.svg)](https://jitpack.io/#aeckar/hass) [![pages-build-deployment](https://github.com/aeckar/hass/actions/workflows/pages/pages-build-deployment/badge.svg?branch=master)](https://github.com/aeckar/hass/actions/workflows/pages/pages-build-deployment) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Maintained?: yes](https://img.shields.io/badge/Maintained%3F-yes-green.svg)\n\n## Overview\n\nThe goal of this library is to offer a simple, yet efficient API for binary (de)serialization.\nIt offers a compact, type-safe binary encoding optimized for ease-of-use... no plugins or code generation required!\n\nThe API offers a high-level DSL capable of creating, consuming, extending, and (de)serializing schemas at runtime.\nPolymorphic serialization is fully supported, with supertypes sharing their serialized data with all subclasses\nin the form of sub-deserializers that can be read from as needed.\n\nRead protocols of abstract classes are prefixed with `fallback`, allowing them to return a default implementation upon deserialization.\nThis is especially useful for collections, whose fundamental structure does not change with each subclass that implements them.\n\nWrite protocols can be prefixed with `static` to override all write operations higher-up in their class hierarchy,\nsaving the need to serialize data that will ultimately be left unused.\n\nDuring building, schemas may extend their functionality with protocols defined in other schemas using an `import from` statement.\nFor API designers, this allows for modularity of serialization logic and a more organized codebase overall.\nAdditionally, they may be optionally made thread-safe by setting the `threadSafe` parameter to true.\n\nThe beauty of the library is that it's *unopinionated*. You can serialize your objects in however way you want.\nThere are no constraints that your classes have a primary constructor with property arguments or derive from a common interface\n(an exception being SAM conversions and lambdas). However, with this flexibility, the user must also explicitly define\nhow every serializable class without a built-in protocol should behave. Despite being a powerful tool, it can be a nuisance\nfor trivial classes whose sole purpose is to contain data. With this, Hass provides the `Container` annotation that automatically\nmakes any class annotated with it serializable and deserializable, so long as it abides by the same rules set by\n`kotlinx.serialization`'s `@Serializable` annotation. That is to say:\n\n- The class must have a public primary constructor\n- All arguments in the primary constructor (if any) must be public properties\n\nThis library is *not* a replacement for [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization).\nIt does not reap the performance benefits of compile-time code generation or the guarantee of multiplatform support.\nIt *does* however, provide an API that lets you serialize things easily and without much thought with *reasonable* performance\nand *excellent* space-efficiency. One drawback, though, is that because the library makes use of JVM-specific reflection,\nit is unlikely that it'll be ported to other platforms. You win some, you lose some. 🤷‍♂️\n\nTo view the full online documentation, visit [https://aeckar.github.io/hass/](https://aeckar.github.io/hass/).\n\n## JVM Interoperability\n\nSchema definition is not supported for other JVM languages.\nHowever, information may still be deserialized and serialized\nby importing schemas and passing them to `Hass.deserializer()` and `Hass.serializer()`,\nrespectively.\n\n## Setup\n\nTo download the library, paste the following into your `build.gradle.kts` file:\n\n```kotlin\nrepositories {\n    maven { url  = uri(\"https://jitpack.io\") }\n}\n\ndependencies {\n    implementation(\"com.github.aeckar:hass:v1.0.0\")\n}\n```\n\n## Getting Started\n\n```kotlin\nimport io.github.aeckar.hass.Container\nimport io.github.aeckar.hass.Schema\nimport io.github.aeckar.hass.deserializer\nimport io.github.aeckar.hass.schema\nimport io.github.aeckar.hass.serializer\nimport java.io.FileInputStream\nimport java.io.FileOutputStream\n\n@Container\ndata class Person(val name: String, val age: Int)\n\nfun main() {\n    val schema: Schema = schema {}\n    FileOutputStream(\"myHassFile.bin\").serializer(schema).use { it.write(Person(\"John Doe\", 34)) }\n    val myPerson: Person = FileInputStream(\"myHassFile.bin\").deserializer(schema).use { it.read() }\n    println(myPerson)    // { name: \"John Doe\", age: 34 }\n}\n```\n\n---\n\nMade with ❤ by Angel Eckardt. If you find this library useful or interesting, please consider giving it a star! 😄\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeckar%2Fhass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faeckar%2Fhass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeckar%2Fhass/lists"}