{"id":21310488,"url":"https://github.com/lebje/tomlkit","last_synced_at":"2025-07-11T23:31:48.629Z","repository":{"id":40399624,"uuid":"369661522","full_name":"LebJe/TOMLKit","owner":"LebJe","description":"A small, simple TOML parser and serializer for Swift. Powered by toml++.","archived":false,"fork":false,"pushed_at":"2024-05-10T20:54:12.000Z","size":5924,"stargazers_count":35,"open_issues_count":2,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-16T07:34:22.058Z","etag":null,"topics":["linux","macos","parser","serializer","swift","swift-package","swift5","toml","toml-parser","toml-parsing","toml-serializer","tomlplusplus","windows","windows-10"],"latest_commit_sha":null,"homepage":"https://lebje.github.io/TOMLKit/documentation/tomlkit","language":"C++","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/LebJe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-05-21T21:52:11.000Z","updated_at":"2024-11-13T11:28:30.000Z","dependencies_parsed_at":"2024-01-03T21:43:34.174Z","dependency_job_id":null,"html_url":"https://github.com/LebJe/TOMLKit","commit_stats":{"total_commits":75,"total_committers":2,"mean_commits":37.5,"dds":"0.026666666666666616","last_synced_commit":"b71455f95543c87d9668664c320678e5a9a32cfe"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LebJe%2FTOMLKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LebJe%2FTOMLKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LebJe%2FTOMLKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LebJe%2FTOMLKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LebJe","download_url":"https://codeload.github.com/LebJe/TOMLKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225769345,"owners_count":17521258,"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":["linux","macos","parser","serializer","swift","swift-package","swift5","toml","toml-parser","toml-parsing","toml-serializer","tomlplusplus","windows","windows-10"],"created_at":"2024-11-21T17:13:47.121Z","updated_at":"2024-11-21T17:13:47.637Z","avatar_url":"https://github.com/LebJe.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TOMLKit\n\n**A small, simple TOML parser and serializer for Swift. Powered by [toml++](https://github.com/marzer/tomlplusplus/).**\n\n[![Swift 5.4](https://img.shields.io/badge/Swift-5.4-brightgreen?logo=swift)](https://swift.org)\n[![SPM Compatible](https://img.shields.io/badge/SPM-compatible-brightgreen.svg)](https://swift.org/package-manager)\n[![](https://img.shields.io/github/v/tag/LebJe/TOMLKit)](https://github.com/LebJe/TOMLKit/releases)\n[![Build and Test](https://github.com/LebJe/TOMLKit/workflows/Build%20and%20Test/badge.svg)](https://github.com/LebJe/TOMLKit/actions?query=workflow%3A%22Build+and+Test%22)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FLebJe%2FTOMLKit%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/LebJe/TOMLKit)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FLebJe%2FTOMLKit%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/LebJe/TOMLKit)\n\nTOMLKit is a [Swift](https://swift.org) wrapper around [toml++](https://github.com/marzer/tomlplusplus/), allowing you to parse and serialize [TOML](https://toml.io) files in Swift.\n\n## Table of Contents\n\n\u003c!--ts--\u003e\n\n-   [TOMLKit](#tomlkit)\n    -   [Table of Contents](#table-of-contents)\n    -   [Installation](#installation)\n        -   [Swift Package Manager](#swift-package-manager)\n    -   [Quick Start](#quick-start)\n        -   [Full Documentation](#full-documentation)\n    -   [Dependencies](#dependencies)\n    -   [Licenses](#licenses)\n    -   [Contributing](#contributing)\n\n\u003c!-- Added by: lebje, at: Fri Apr  1 15:58:35 EDT 2022 --\u003e\n\n\u003c!--te--\u003e\n\nCreated by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)\n\n## Installation\n\n### Swift Package Manager\n\nAdd this to the `dependencies` array in `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/LebJe/TOMLKit.git\", from: \"0.5.0\")\n```\n\nAlso add this to the `targets` array in the aforementioned file:\n\n```swift\n.product(name: \"TOMLKit\", package: \"TOMLKit\")\n```\n\n## Quick Start\n\n```swift\nimport TOMLKit\nimport struct Foundation.Date\n\nlet toml = \"\"\"\nstring = \"Hello, World!\"\nint = 523053\ndouble = 3250.34\n\"\"\"\n\nstruct Test: Codable {\n    let string: String\n    let int: Int\n    let double: Double\n}\n\ndo {\n   let table = try TOMLTable(string: toml)\n   table.remove(at: \"double\")\n\n   table[\"dateTime\"] = TOMLDateTime(date: Foundation.Date())\n   table.insert(\n      TOMLArray([1, 2, \"3\", TOMLTable([\"time\": TOMLTime(hour: 10, minute: 26, second: 49, nanoSecond: 203)])]),\n      at: \"array\"\n   )\n\n   let test = Test(string: \"Goodbye, World!\", int: 24598, double: 18.247)\n   let encodedTest: TOMLTable = try TOMLEncoder().encode(test)\n   let decodedTest = try TOMLDecoder().decode(Test.self, from: encodedTest)\n\n   print(\"----Encoding \u0026 Decoding----\\n\")\n\n   print(\"Encoded Test: \\n\\(encodedTest)\\n\")\n   print(\"Decoded Test: \\(decodedTest)\")\n\n   print(\"\\n----Conversion----\\n\")\n\n   print(\"TOML:\\n\\(table.convert(to: .toml))\\n\")\n   print(\"JSON:\\n\\(table.convert(to: .json))\\n\")\n   print(\"YAML:\\n\\(table.convert(to: .yaml))\")\n} catch let error as TOMLParseError {\n   // TOMLParseError occurs when the TOML document is invalid.\n   // `error.source.begin` contains the line and column where the error started,\n   // and `error.source.end` contains the line where the error ended.\n    print(error.source.begin)\n    print(error.source.end)\n}\n\n// ----Encoding \u0026 Decoding----\n//\n// Encoded Test:\n// double = 18.247\n// int = 24598\n// string = 'Goodbye, World!'\n//\n// Decoded Test: Test(string: \"Goodbye, World!\", int: 24598, double: 18.247)\n//\n// ----Conversion----\n//\n// TOML:\n// array = [ 1, 2, '3', { time = 10:26:49.000000203 } ]\n// dateTime = 2022-03-31T12:19:38.160653948Z\n// int = 523053\n// string = 'Hello, World!'\n//\n// JSON:\n// {\n//     \"array\" : [\n//         1,\n//         2,\n//         \"3\",\n//         {\n//             \"time\" : \"10:26:49.000000203\"\n//         }\n//     ],\n//     \"dateTime\" : \"2022-03-31T12:19:38.160653948Z\",\n//     \"int\" : 523053,\n//     \"string\" : \"Hello, World!\"\n// }\n//\n// YAML:\n// array:\n//   - 1\n//   - 2\n//   - 3\n//   - time: '10:26:49.000000203'\n// dateTime: '2022-03-31T12:19:38.160653948Z'\n// int: 523053\n// string: 'Hello, World!'\n```\n\n### Full Documentation\n\nFull documentation is available [here](https://lebje.github.io/TOMLKit/documentation/tomlkit/).\n\n## Dependencies\n\n-   [toml++](https://github.com/marzer/tomlplusplus/)\n\n## Licenses\n\nThe [toml++](https://github.com/marzer/tomlplusplus/) license is available in the `tomlplusplus` directory in the `LICENSE` file.\n\n## Contributing\n\nBefore committing, please install [pre-commit](https://pre-commit.com), [swift-format](https://github.com/nicklockwood/SwiftFormat), [clang-format](https://clang.llvm.org/docs/ClangFormat.html), and [Prettier](https://prettier.io), then install the pre-commit hook:\n\n```bash\n$ brew bundle # install the packages specified in Brewfile\n$ pre-commit install\n\n# Commit your changes.\n```\n\nTo install pre-commit on other platforms, refer to the [documentation](https://pre-commit.com/#install).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebje%2Ftomlkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flebje%2Ftomlkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebje%2Ftomlkit/lists"}