{"id":24084492,"url":"https://github.com/ilevd/toml","last_synced_at":"2025-04-30T20:43:38.476Z","repository":{"id":14985861,"uuid":"77390633","full_name":"ilevd/toml","owner":"ilevd","description":"Clojure TOML wrapper","archived":false,"fork":false,"pushed_at":"2022-04-21T06:34:13.000Z","size":30,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T20:26:23.403Z","etag":null,"topics":["clojure","toml"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilevd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-26T15:01:26.000Z","updated_at":"2023-10-27T14:28:23.000Z","dependencies_parsed_at":"2022-08-07T08:00:47.713Z","dependency_job_id":null,"html_url":"https://github.com/ilevd/toml","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/ilevd%2Ftoml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilevd%2Ftoml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilevd%2Ftoml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilevd%2Ftoml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilevd","download_url":"https://codeload.github.com/ilevd/toml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251779205,"owners_count":21642517,"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":["clojure","toml"],"created_at":"2025-01-10T00:37:18.213Z","updated_at":"2025-04-30T20:43:38.443Z","avatar_url":"https://github.com/ilevd.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# toml\n\nTOML is a configuration format, similar to JSON, but much more human readable. It's like YAML, but easier to write. You can read about it [here](https://npf.io/2014/08/intro-to-toml/).\n\nThis is a Clojure [TOML](https://github.com/toml-lang/toml) wrapper based on Java [toml4j](https://github.com/mwanji/toml4j) library.\nThe tests are from [clj-toml](https://github.com/lantiga/clj-toml).\n\n\n## Installation\n\n#### Leiningen\n\n[![Clojars Project](https://clojars.org/toml/latest-version.svg)](http://clojars.org/toml)\n\n## Usage\n\n```clojure\n(:require [toml.core :as toml])\n\n(toml/read \"a = 10\\nb = 20\")\n=\u003e {\"a\" 10, \"b\" 20}\n```\n\nYou can keywordize result keys, just pass ``:keywordize``\n\n```clojure\n(toml/read \"a = 10\\nb = 20\" :keywordize)\n=\u003e {:a 10, :b 20}\n```\n\nMore complex example, assuming you have example.toml:\n```toml\n# This is a TOML document.\n\ntitle = \"TOML Example\"\n\n[owner]\nname = \"Tom Preston-Werner\"\ndob = 1979-05-27T07:32:00-08:00 # First class dates\n\n[database]\nserver = \"192.168.1.1\"\nports = [ 8001, 8001, 8002 ]\nconnection_max = 5000\nenabled = true\n\n[servers]\n\n  # Indentation (tabs and/or spaces) is allowed but not required\n  [servers.alpha]\n  ip = \"10.0.0.1\"\n  dc = \"eqdc10\"\n\n  [servers.beta]\n  ip = \"10.0.0.2\"\n  dc = \"eqdc10\"\n\n[clients]\ndata = [ [\"gamma\", \"delta\"], [1, 2] ]\n\n# Line breaks are OK when inside arrays\nhosts = [\n  \"alpha\",\n  \"omega\"\n]\n\n[[storages]]\nname = \"Redis\"\npriority = 10\n\n[[storages]]\nname = \"Memcached\"\npriority = 5\n```\n\nJust do it:\n```clojure\n(toml/read (slurp \"./resources/example.toml\") :keywordize)\n=\u003e \n{:owner {:dob #inst\"1979-05-27T15:32:00.000-00:00\", :name \"Tom Preston-Werner\"},\n :storages [{:name \"Redis\", :priority 10} {:name \"Memcached\", :priority 5}],\n :database {:server \"192.168.1.1\", :connection_max 5000, :ports [8001 8001 8002], :enabled true},\n :servers {:alpha {:ip \"10.0.0.1\", :dc \"eqdc10\"}, :beta {:ip \"10.0.0.2\", :dc \"eqdc10\"}},\n :clients {:data [[\"gamma\" \"delta\"] [1 2]], :hosts [\"alpha\" \"omega\"]},\n :title \"TOML Example\"}\n```\n\nYou can also generate TOML doc (for simple cases by now):\n\n```clojure\n(toml/write {:owner    {:name \"Tom Preston-Werner\"},\n             :database {:server \"192.168.1.1\", :connection_max 5000, :port 8002, :enabled true},\n             :servers  {:alpha {:ip \"10.0.0.1\", :dc \"eqdc10\"}, :beta {:ip \"10.0.0.2\", :dc \"eqdc10\"}},\n             :title    \"TOML Example\"})\n=\u003e\n\"title = \\\"TOML Example\\\"\n \n [owner]\n name = \\\"Tom Preston-Werner\\\"\n \n [database]\n server = \\\"192.168.1.1\\\"\n connection_max = 5000\n port = 8002\n enabled = true\n \n [servers.alpha]\n ip = \\\"10.0.0.1\\\"\n dc = \\\"eqdc10\\\"\n \n [servers.beta]\n ip = \\\"10.0.0.2\\\"\n dc = \\\"eqdc10\\\"\n \"\n\n```\n\n\nFor more information, please, visit [toml4j](https://github.com/mwanji/toml4j) library.\n\n## License\n\nilevd © 2016-2018\n\nDistributed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filevd%2Ftoml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filevd%2Ftoml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filevd%2Ftoml/lists"}