{"id":13710192,"url":"https://github.com/sam701/zig-toml","last_synced_at":"2025-09-20T01:48:05.339Z","repository":{"id":93646507,"uuid":"580553653","full_name":"sam701/zig-toml","owner":"sam701","description":"Zig TOML (v1.0.0) parser","archived":false,"fork":false,"pushed_at":"2025-09-06T20:48:42.000Z","size":156,"stargazers_count":69,"open_issues_count":1,"forks_count":25,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-06T22:13:59.226Z","etag":null,"topics":["parser","toml","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/sam701.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-12-20T21:06:03.000Z","updated_at":"2025-09-05T06:12:30.000Z","dependencies_parsed_at":"2023-03-04T05:15:18.555Z","dependency_job_id":"ee397519-79c7-4952-b811-d7243a22304d","html_url":"https://github.com/sam701/zig-toml","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sam701/zig-toml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Fzig-toml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Fzig-toml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Fzig-toml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Fzig-toml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sam701","download_url":"https://codeload.github.com/sam701/zig-toml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Fzig-toml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276032907,"owners_count":25573468,"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","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["parser","toml","zig-package","ziglang"],"created_at":"2024-08-02T23:00:52.918Z","updated_at":"2025-09-20T01:48:05.325Z","avatar_url":"https://github.com/sam701.png","language":"Zig","readme":"# zig-toml\n[![Zig Docs](https://img.shields.io/badge/docs-zig-%23f7a41d)](https://sam701.github.io/zig-toml)\n\nZig [TOML v1.0.0](https://toml.io/en/v1.0.0) parser.\n\nThis is a top-down LL parser that parses directly into Zig structs.\n\n## Features\n* TOML Syntax\n  * [x] Integers, hexadecimal, octal, and binary numbers\n  * [x] Floats\n  * [x] Booleans\n  * [x] Comments\n  * [x] Arrays\n  * [x] Tables\n  * [x] Array of Tables\n  * [x] Inline Table\n  * [x] Single-line strings\n  * [x] String escapes (also unicode)\n  * [x] Multi-line strings\n  * [x] Multi-line string leading space trimming\n  * [x] Trailing backslash in multi-line strings\n  * [x] Date, time, date-time, time offset\n* Struct mapping\n  * [x] Mapping to structs\n  * [x] Mapping to enums\n  * [x] Mapping to slices\n  * [x] Mapping to arrays\n  * [x] Mapping to pointers\n  * [x] Mapping to integer and floats with lower bit number than defined by TOML, i.e. `i16`, `f32`.\n  * [x] Mapping to optional fields\n  * [x] Mapping to HashMaps\n* [ ] Serialization\n    * [x] Basic types like integers, floating points, strings, booleans etc.\n    * [x] Arrays\n    * [x] Top level tables\n    * [x] Sub tables\n    * [x] Pointers\n    * [x] Date, time, DateTime, time offset\n    * [x] Enums\n    * [x] Unions\n\n## Using with the Zig package manager\nAdd `zig-toml` to your `build.zig.zon`\n```\n# For zig-master\nzig fetch --save git+https://github.com/sam701/zig-toml\n\n# For zig 0.13\nzig fetch --save git+https://github.com/sam701/zig-toml#last-zig-0.13\n```\n\n## Example\nSee [`example1.zig`](./examples/example1.zig) for the complete code that parses [`example.toml`](./examples/example1.toml)\n\nRun it with `zig build examples`\n```zig\n// ....\n\nconst Address = struct {\n    port: i64,\n    host: []const u8,\n};\n\nconst Config = struct {\n    master: bool,\n    expires_at: toml.DateTime,\n    description: []const u8,\n\n    local: *Address,\n    peers: []const Address,\n};\n\npub fn main() anyerror!void {\n    var parser = toml.Parser(Config).init(allocator);\n    defer parser.deinit();\n\n    var result = try parser.parseFile(\"./examples/example1.toml\");\n    defer result.deinit();\n\n    const config = result.value;\n    std.debug.print(\"{s}\\nlocal address: {s}:{}\\n\", .{ config.description, config.local.host, config.local.port });\n    std.debug.print(\"peer0: {s}:{}\\n\", .{ config.peers[0].host, config.peers[0].port });\n}\n```\n\n## Error Handling\nTODO\n\n## License\nMIT\n","funding_links":[],"categories":["Language Essentials","Applications"],"sub_categories":["File Format Processing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam701%2Fzig-toml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsam701%2Fzig-toml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam701%2Fzig-toml/lists"}