{"id":20718510,"url":"https://github.com/knowm/konfig","last_synced_at":"2026-03-16T11:09:07.864Z","repository":{"id":22892005,"uuid":"97598476","full_name":"knowm/Konfig","owner":"knowm","description":"Konfig is a tool to deserialize JSON/YAML configuration files, while additionally validating and auto-generating documentation.","archived":false,"fork":false,"pushed_at":"2023-01-16T12:00:27.000Z","size":232,"stargazers_count":5,"open_issues_count":15,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-04T15:29:56.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knowm.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}},"created_at":"2017-07-18T12:59:29.000Z","updated_at":"2024-03-31T14:19:42.000Z","dependencies_parsed_at":"2023-02-10T03:00:36.436Z","dependency_job_id":null,"html_url":"https://github.com/knowm/Konfig","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/knowm/Konfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FKonfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FKonfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FKonfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FKonfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knowm","download_url":"https://codeload.github.com/knowm/Konfig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FKonfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278273768,"owners_count":25959798,"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-10-04T02:00:05.491Z","response_time":63,"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":[],"created_at":"2024-11-17T03:13:52.024Z","updated_at":"2025-10-04T06:18:47.686Z","avatar_url":"https://github.com/knowm.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Konfig\n\nKonfig is a tool to deserialize JSON/YAML configuration files, while additionally validating and auto-generating documentation.\n\n## Description\n\nKonfig is a fork of `dropwizard-configuration`. Konfig removes a few dependencies including Guava and Logback and does away with the need to add\ncertain files in `META_INF`. Konfig allows you to serialize and deserialize configuration objects to either YAML or JSON from annotated Java\nclasses. While deserializing, Konfig validates each property's given value if an appropriate annotation is included (`@Min`, `@Max`, etc.).\n\nKonfig-dox is a Maven  plugin that auto-generates documentation for your configuration classes based off the annotations and class and property\nJavaDocs. Given an array of package names to search, it will find all classes implementing `Konfigurable` and generate the documentation in JSON\nand HTML form.\n\n\n## Example.java\n\n```java\n  private void goJSON() throws IOException, ConfigurationException {\n\n    ConfigurableObject configurableObject =\n        new Konfig\u003cConfigurableObject\u003e()\n            .buildConfigurationfromJSONFileAsResource(ConfigurableObject.class, \"example.json\");\n\n    System.out.println(configurableObject.toString());\n  }\n```\n\n## example.json\n\n```json\n{\n    \"name\": \"Coda Hale\",\n    \"type\": [\n        \"coder\",\n        \"wizard\"\n    ],\n    \"properties\": {\n        \"debug\": true,\n        \"settings.enabled\": false\n    },\n    \"servers\": [\n        {\n            \"port\": 8080\n        },\n        {\n            \"port\": 8081\n        },\n        {\n            \"port\": 8082\n        }\n    ],\n    \"my.logger\": {\n        \"level\": \"info\"\n    }\n}\n```\n\n## ConfigurableObject.java \n\n```java\npublic class ConfigurableObject implements Konfigurable {\n\n  @NotNull\n  @Pattern(regexp = \"[\\\\w]+[\\\\s]+[\\\\w]+([\\\\s][\\\\w]+)?\")\n  private String name;\n\n  @JsonProperty private int age = 1;\n\n  List\u003cString\u003e type;\n\n  @JsonProperty private Map\u003cString, String\u003e properties = new LinkedHashMap\u003c\u003e();\n\n  @JsonProperty private List\u003cExampleServer\u003e servers = new ArrayList\u003c\u003e();\n\n  private boolean admin;\n\n  @JsonProperty(\"my.logger\")\n  private Map\u003cString, String\u003e logger = new LinkedHashMap\u003c\u003e();\n\n  public String getName() {\n    return name;\n  }\n\n  public List\u003cString\u003e getType() {\n    return type;\n  }\n\n  public Map\u003cString, String\u003e getProperties() {\n    return properties;\n  }\n\n  public List\u003cExampleServer\u003e getServers() {\n    return servers;\n  }\n\n  public boolean isAdmin() {\n    return admin;\n  }\n\n  public void setAdmin(boolean admin) {\n    this.admin = admin;\n  }\n\n  public Map\u003cString, String\u003e getLogger() {\n    return logger;\n  }\n\n  @Override\n  public String toString() {\n    return \"ConfigurableObject [name=\"\n        + name\n        + \", age=\"\n        + age\n        + \", type=\"\n        + type\n        + \", properties=\"\n        + properties\n        + \", servers=\"\n        + servers\n        + \", admin=\"\n        + admin\n        + \", logger=\"\n        + logger\n        + \"]\";\n  }\n}\n```\n\n## Output\n\n```\nConfigurableObject [name=Coda Hale, age=1, type=[coder, wizard], properties={debug=true, settings.enabled=false}, servers=[ExampleServer [port=8080], ExampleServer [port=8081], ExampleServer [port=8082]], admin=false, logger={level=info}]\n```\n\n## Extra Options\n\n1. You can override value with a Java Vm arg like this: `-Dk.name=\"Tim Molter\"`.\n1. Annotations can be use to constrain fields: min, max, etc.\n1. You can load config files as Strings, from resources and as a File.\n\n## Building\n\nKonfig is built with Maven, which also handles dependency management.\n\n### general\n\n    cd path/to/project\n    mvn clean package\n    mvn javadoc:aggregate\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowm%2Fkonfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknowm%2Fkonfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowm%2Fkonfig/lists"}