{"id":32163984,"url":"https://github.com/nikolauska/toml_elixir","last_synced_at":"2026-02-19T08:02:17.378Z","repository":{"id":62430473,"uuid":"90528759","full_name":"nikolauska/toml_elixir","owner":"nikolauska","description":"TOML parser for elixir","archived":false,"fork":false,"pushed_at":"2026-02-15T14:48:16.000Z","size":199,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-15T21:24:35.218Z","etag":null,"topics":["elixir","toml"],"latest_commit_sha":null,"homepage":null,"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/nikolauska.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2017-05-07T11:44:17.000Z","updated_at":"2026-02-15T14:45:29.000Z","dependencies_parsed_at":"2022-11-01T20:30:57.216Z","dependency_job_id":null,"html_url":"https://github.com/nikolauska/toml_elixir","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nikolauska/toml_elixir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolauska%2Ftoml_elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolauska%2Ftoml_elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolauska%2Ftoml_elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolauska%2Ftoml_elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikolauska","download_url":"https://codeload.github.com/nikolauska/toml_elixir/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolauska%2Ftoml_elixir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29608152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["elixir","toml"],"created_at":"2025-10-21T14:41:34.128Z","updated_at":"2026-02-19T08:02:17.373Z","avatar_url":"https://github.com/nikolauska.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TomlElixir\n\n[![Build Status](https://github.com/nikolauska/toml_elixir/actions/workflows/elixir.yml/badge.svg)](https://github.com/nikolauska/toml_elixir/actions)\n[![Coverage Status](https://coveralls.io/repos/github/nikolauska/toml_elixir/badge.svg?branch=master)](https://coveralls.io/github/nikolauska/toml_elixir?branch=master)\n[![Hex version](https://img.shields.io/hexpm/v/toml_elixir.svg)](https://hex.pm/packages/toml_elixir)\n\n**TomlElixir** is a modern, high-performance [TOML](https://github.com/toml-lang/toml) parser and encoder for Elixir. It is designed to be fully compliant with the TOML specification while providing an idiomatic Elixir experience.\n\n## Features\n\n- **Full Specification Support**: Supports both TOML **1.0.0** and **1.1.0** specifications.\n- **Native Elixir Types**: Decodes TOML directly into native Elixir types (`DateTime`, `NaiveDateTime`, `Date`, `Time`, `Float`, `Integer`, `Boolean`, `String`, `Map`, `List`).\n- **Bidirectional**: Full support for both decoding (TOML to Map) and encoding (Map to TOML).\n- **Strict Parsing**: Comprehensive error messages for invalid TOML documents.\n- **Spec Selection**: Allows you to choose which TOML version to follow during decoding.\n- **Struct Support**: Use the `TomlElixir.Encoder` protocol to encode custom structs via `@derive`.\n\n## Installation\n\nAdd `toml_elixir` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:toml_elixir, \"~\u003e 3.0.0\"}\n  ]\nend\n```\n\n## Usage\n\n### Decoding TOML\n\nConvert a TOML string into an Elixir Map.\n\n```elixir\ntoml_string = \"\"\"\ntitle = \"TOML Example\"\n\n[database]\nenabled = true\nports = [ 8000, 8001, 8002 ]\ntemp_targets = { cpu = 79.5, case = 72.0 }\n\"\"\"\n\n# Simple decoding\n{:ok, data} = TomlElixir.decode(toml_string)\ndata = TomlElixir.decode!(toml_string)\n\n# Specify TOML version (default is :\"1.1.0\")\nTomlElixir.decode(toml_string, spec: :\"1.0.0\")\n```\n\n### Encoding to TOML\n\nConvert an Elixir Map back into a valid TOML string.\n\n```elixir\ndata = %{\n  \"title\" =\u003e \"TOML Example\",\n  \"database\" =\u003e %{\n    \"enabled\" =\u003e true,\n    \"ports\" =\u003e [8000, 8001, 8002]\n  }\n}\n\n{:ok, toml_string} = TomlElixir.encode(data)\ntoml_string = TomlElixir.encode!(data)\n```\n\n### Encoding Structs\n\nYou can use the `TomlElixir.Encoder` protocol to allow your structs to be encoded as TOML.\n\n```elixir\ndefmodule User do\n  @derive TomlElixir.Encoder\n  defstruct [:name, :age]\nend\n\nuser = %User{name: \"Alice\", age: 30}\ntoml_string = TomlElixir.encode!(%{user: user})\n# [user]\n# age = 30\n# name = \"Alice\"\n```\n\nYou can also choose which struct keys are encoded:\n\n```elixir\ndefmodule User do\n  @derive {TomlElixir.Encoder, only: [:name]}\n  defstruct [:name, :age, :password]\nend\n\ndefmodule PublicUser do\n  @derive {TomlElixir.Encoder, except: [:password]}\n  defstruct [:name, :age, :password]\nend\n```\n\nPrefer `:only` to avoid leaking new fields added to a struct in the future.\n\nIf you do not own the struct module, you can derive the protocol externally:\n\n```elixir\nProtocol.derive(TomlElixir.Encoder, NameOfTheStruct, only: [:public_field])\nProtocol.derive(TomlElixir.Encoder, NameOfTheStruct, except: [:private_field])\nProtocol.derive(TomlElixir.Encoder, NameOfTheStruct)\n```\n\n## Type Mapping\n\n| TOML Type | Elixir Type |\n| :--- | :--- |\n| String | `String.t()` |\n| Integer | `Integer.t()` |\n| Float | `Float.t()` (plus `:infinity`, `:neg_infinity`, `:nan`) |\n| Boolean | `boolean()` |\n| Offset Date-Time | `DateTime.t()` |\n| Local Date-Time | `NaiveDateTime.t()` |\n| Local Date | `Date.t()` |\n| Local Time | `Time.t()` |\n| Array | `List.t()` |\n| Table | `Map.t()` |\n| Inline Table | `Map.t()` |\n\n## Contribution\n\nContributions are welcome! If you find a bug or want to suggest a feature, please open an issue or submit a pull request. Make sure all tests pass before submitting.\n\n```bash\n# Run tests\nmix test\n\n# Run coverage report\nmix coveralls\n```\n\n## License\n\nTomlElixir is released under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolauska%2Ftoml_elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikolauska%2Ftoml_elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolauska%2Ftoml_elixir/lists"}