{"id":14969802,"url":"https://github.com/mikhailvs/simple-serializer","last_synced_at":"2025-10-26T09:30:59.711Z","repository":{"id":33610370,"uuid":"157255816","full_name":"mikhailvs/simple-serializer","owner":"mikhailvs","description":"Easily serialize any object.","archived":false,"fork":false,"pushed_at":"2024-05-16T19:41:18.000Z","size":12,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-24T09:04:16.607Z","etag":null,"topics":["json-serialization","rails","ruby","serialization","serialize","serialize-objects","serializer"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/mikhailvs.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":"2018-11-12T18:11:42.000Z","updated_at":"2022-02-23T20:57:10.000Z","dependencies_parsed_at":"2024-11-16T02:50:32.866Z","dependency_job_id":"1e9daee1-6807-4857-abeb-4b50f44ff49f","html_url":"https://github.com/mikhailvs/simple-serializer","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":"0.19999999999999996","last_synced_commit":"08a76d795231efacac0204b1c145c547f564bae4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikhailvs%2Fsimple-serializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikhailvs%2Fsimple-serializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikhailvs%2Fsimple-serializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikhailvs%2Fsimple-serializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikhailvs","download_url":"https://codeload.github.com/mikhailvs/simple-serializer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238301277,"owners_count":19449413,"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":["json-serialization","rails","ruby","serialization","serialize","serialize-objects","serializer"],"created_at":"2024-09-24T13:42:24.760Z","updated_at":"2025-10-26T09:30:58.125Z","avatar_url":"https://github.com/mikhailvs.png","language":"Ruby","readme":"# SimpleSerializer\n[![Gem Version](https://badge.fury.io/rb/simple-serializer.svg)](https://badge.fury.io/rb/simple-serializer)\n\n## Install\n\nGemfile:\n```ruby\ngem 'simple-serializer'\n```\n\nShell:\n```sh\ngem install simple-serializer\n```\n\n## Usage\n```ruby\nrequire 'simple-serializer'\n\nclass Account \u003c ApplicationRecord; end\n\nclass AccountSerializer \u003c SimpleSerializer\n  # define multiple attributes to include in the serialized object\n  attributes :id, :created_at, :updated_at\n\n  # define one attribute at a time\n  attribute :email_address\n\n  # provide an alias for an attribute (object_attr_name: :new_name)\n  attribute customer_phone_number: :phone_number\n\n  # define a proc for computed attributes\n  attribute(:name) { [first_name, last_name].join(' ') }\n  \n  # serialize nested objects\n  serialize(:address) do\n    attributes :line1, :line2, :city, :state, :zipcode\n  end\nend\n\n# You can serialize an object by calling .to_h or .to_json on the serializer\nAccountSerializer.to_h(Account.first)\n\n# if you pass in an enumerable instead of a single object, each one will be serialized\nAccountSerializer.to_h(Account.all)\n\n# include YourSerializer.helpers in your object's class to get a more convenient interface\nclass Account\n  include AccountSerializer.helpers \nend\n\n# this is the same as calling AccountSerializer.to_h[Account.first]\nAccount.first.to_h\n\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikhailvs%2Fsimple-serializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikhailvs%2Fsimple-serializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikhailvs%2Fsimple-serializer/lists"}