serializable
Version, currently main branch1 version
- main branchlatestJan 30, 2025
github.com/jgaskins/serializable
Unified serialization interface for Crystal
Installation
# Add this to your shard.yml
dependencies:
serializable:
github: jgaskins/serializable
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.13.2- License
- MIT
- Author
- Jamie Gaskins
Dependencies
Development Dependencies
- db*github: crystal-lang/crystal-dbdev
- pg*github: will/crystal-pgdev
- msgpack*github: jgaskins/msgpack-crystal, branch: serializable-unifieddev
- serializable*path: .dev
README
Serializable
Unified serialization/deserialization interface.
Installation
-
Add the dependency to your
shard.yml:dependencies: serializable: github: jgaskins/serializable -
Run
shards install
Usage
In your serializable objects, include the Serializable::Object mixin:
require "serializable/object"
struct Post
include Serializable::Object
getter id : UUID
getter title : String
getter body : String
getter author_id : UUID
getter author_display_name : String
getter published_at : Time
end
Make sure you require any of the adapters needed for the serialization formats you are using:
require "serializable/json"
require "serializable/msgpack"
require "serializable/db"
These adapters add the from_#{format} / to_#{format} methods. If you only need JSON, you can simply require the serializable/json adapter.
If you need additional serialization formats, please open an issue or a PR.
Development
This is still early days for this shard. The development process hasn't been ironed out yet.
Contributing
- Fork it (https://github.com/jgaskins/serializable/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Jamie Gaskins - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Jan 30, 2025
- Crystal
>= 1.13.2- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/jgaskins/serializable
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1