{"id":13507298,"url":"https://github.com/spacepilots/mason","last_synced_at":"2025-10-21T15:15:26.223Z","repository":{"id":57521384,"uuid":"138142941","full_name":"spacepilots/mason","owner":"spacepilots","description":" Mason uses superpowers to coerce maps into structs. This is helpful e.g. when you interface a REST API and want to create a struct from the response.","archived":false,"fork":false,"pushed_at":"2018-06-21T11:48:16.000Z","size":5,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2024-10-04T10:19:35.066Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/spacepilots.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-21T08:36:08.000Z","updated_at":"2023-10-05T11:58:33.000Z","dependencies_parsed_at":"2022-09-26T18:01:19.338Z","dependency_job_id":null,"html_url":"https://github.com/spacepilots/mason","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacepilots%2Fmason","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacepilots%2Fmason/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacepilots%2Fmason/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacepilots%2Fmason/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacepilots","download_url":"https://codeload.github.com/spacepilots/mason/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222535162,"owners_count":16999232,"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":[],"created_at":"2024-08-01T02:00:30.415Z","updated_at":"2025-10-21T15:15:21.192Z","avatar_url":"https://github.com/spacepilots.png","language":"Elixir","funding_links":[],"categories":["Algorithms and Data structures"],"sub_categories":[],"readme":"# Mason ![Build Status](https://travis-ci.org/spacepilots/mason.svg?branch=develop)\n\nMason uses superpowers to coerce maps into structs. This is helpful e.g.\nwhen you interface a REST API and want to create a struct from the response.\n\n```elixir\ndefmodule User do\n  defstruct [ :user_id, :created_at ]\n\n  def masonstruct do\n    %{\n      createdAt: \u0026({ :created_at, elem(DateTime.from_unix(\u00261), 1) }),\n      userId: \u0026({ :user_id, \u00261 })\n    }\n  end\nend\n\nresponse = %{ \"userId\" =\u003e 123, createdAt: 1456749030 }\nMason.struct User, response # %User{created_at: #DateTime\u003c2016-02-29 12:30:30Z\u003e, user_id: 123}\n```\n\n## Features\n\n* coerce to Elixir's built-in types from strings\n* dynamically coerce values (e.g. timestamps to `DateTime`s)\n* map keys (e.g. `createdAt` to `created_at`)\n* convert string keys to atoms (e.g. `..., \"age\" =\u003e 29, ...` to `..., age: 29, ...`)\n* convert lists\n\n## Installation\n\nThe package can be installed by adding `mason` to your list of\ndependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:mason, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nThe docs can be found at [https://hexdocs.pm/mason](https://hexdocs.pm/mason).\n\n## Contributing\n\n* We use [gitflow](https://github.com/nvie/gitflow) (with the production branch\n  being `master` and the development branch being `develop`)\n* and [semantic commit messages](https://seesparkbox.com/foundry/semantic_commit_messages).\n* We use [semantic versioning](https://semver.org/).\n* We use pull requests and run our test suite on [Travis CI](https://travis-ci.org/spacepilots/mason).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacepilots%2Fmason","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacepilots%2Fmason","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacepilots%2Fmason/lists"}