{"id":19306330,"url":"https://github.com/kdl-org/kdl4j","last_synced_at":"2025-07-16T07:33:01.916Z","repository":{"id":37025729,"uuid":"327394345","full_name":"kdl-org/kdl4j","owner":"kdl-org","description":"KDL Parser for the JVM","archived":false,"fork":false,"pushed_at":"2025-07-14T14:11:06.000Z","size":642,"stargazers_count":42,"open_issues_count":4,"forks_count":9,"subscribers_count":6,"default_branch":"trunk","last_synced_at":"2025-07-14T17:33:36.714Z","etag":null,"topics":["java","jvm","kdl","serialization"],"latest_commit_sha":null,"homepage":"","language":"Java","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/kdl-org.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2021-01-06T18:15:43.000Z","updated_at":"2025-07-14T14:09:26.000Z","dependencies_parsed_at":"2025-04-13T20:24:34.939Z","dependency_job_id":"504c9994-bc19-4234-a6c2-f47ac99e5ed3","html_url":"https://github.com/kdl-org/kdl4j","commit_stats":null,"previous_names":["kdl-org/kdl4j"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/kdl-org/kdl4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdl-org%2Fkdl4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdl-org%2Fkdl4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdl-org%2Fkdl4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdl-org%2Fkdl4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdl-org","download_url":"https://codeload.github.com/kdl-org/kdl4j/tar.gz/refs/heads/trunk","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdl-org%2Fkdl4j/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265492259,"owners_count":23776012,"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":["java","jvm","kdl","serialization"],"created_at":"2024-11-10T00:05:35.533Z","updated_at":"2025-07-16T07:33:01.908Z","avatar_url":"https://github.com/kdl-org.png","language":"Java","funding_links":[],"categories":["java"],"sub_categories":[],"readme":"# Kdl4J\n\nA Java implementation of a parser for the [KDL Document Language](https://github.com/kdl-org/kdl).\nSupports both KDL v1 and KDL v2 syntaxes.\n\nThis library targets Java 17 as a minimum version.\n\n![Build Workflow Badge](https://github.com/kdl-org/kdl4j/workflows/Build%20Workflow/badge.svg)\n\n## Usage\n\n### Dependency\n\nReleases are published on [GitHub Packages](https://docs.github.com/en/packages). You need to\nauthenticate with GitHub using a token with `read:packages` permission. See the official\ndocumentation for more information on how to authenticate on GitHub Packages\nfor [Maven](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry)\nor\nfor [Gradle](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry).\n\nThen you can add the Kdl4J dependency.\n\nMaven:\n\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003edev.kdl\u003c/groupId\u003e\n\t\u003cartifactId\u003ekdl4j\u003c/artifactId\u003e\n\t\u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGradle:\n\n```groovy\nimplementation 'dev.kdl:kdl4j:1.0.0'\n```\n\nAlternatively, you can use the packages [hosted by JitPack](https://jitpack.io/#kdl-org/kdl4j). In\nthis case, make sure you use the `com.github.kdl-org` groupId.\n\n### Parsing\n\nThe `KdlParser` class can create a parser for KDL v1 or KDL v2 syntax. It can also create a _hybrid_\nparser that first tries to parse using v2 syntax but switches to v1 syntax if parsing fails.\n\nParsers are thread-safe.\n\n```java\n// Create a KDL 2 parser\nvar parser = KdlParser.v2();\n// Parse from a String\nvar documentFromString = parser.parse(\"node_name \\\"arg\\\"\");\n// Parse from an InputStream\nvar documentFromReader = parser.parse(new ByteArrayInputStream(/* … */));\n// Parse from a file\nvar documentFromReader = parser.parse(Paths.get(\"path\", \"to\", \"file\"));\n```\n\n#### Displaying parsing errors to users\n\nThe `Reporter` class can display an error message from a `KdlParseException`, which is thrown when a\ndocument is invalid. The report can optionally include ANSI escape codes for color.\n\nExample:\n\n```\n× Number or identifier cannot start with '.':\n  ╭─[test.kdl:1:6]\n1 │ node .0n\n  ·      ┬\n  ·      ╰ invalid character\n  ╰─\nhelp: for a number add a zero before '.', for an identifier use quotes\n```\n\n### Printing\n\nThe `KdlPrinter` class allows printing a KDL document to a `String`, a `Writer`, an `OutputStream`\nor to a file. By default, it:\n\n- uses KDL 2.0 syntax\n- prints one character tabulation for each indentation level\n- uses _line feed_ as the newline character\n- does not print node separators (`;`)\n- does not print braces for nodes without children\n- prints arguments and properties with null value\n- prints all duplicate properties\n- prints properties in the declaration order\n- uses `E` as the exponent character in decimal values\n- does not print quotes around identifiers\n\nAny of these can be changed by creating a `PrintConfiguration` and passing it to the `KDLPrinter`\nconstructor.\n\n## Contributing\n\nPlease read the Code of Conduct before opening any issues or pull requests. The easiest way to help\nis by writing documentation or test cases, but all contributions are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdl-org%2Fkdl4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdl-org%2Fkdl4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdl-org%2Fkdl4j/lists"}