{"id":20098640,"url":"https://github.com/pfnet/jsonconfig","last_synced_at":"2025-06-14T11:04:27.358Z","repository":{"id":5994523,"uuid":"7217197","full_name":"pfnet/jsonconfig","owner":"pfnet","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-15T05:39:19.000Z","size":599,"stargazers_count":0,"open_issues_count":1,"forks_count":3,"subscribers_count":105,"default_branch":"master","last_synced_at":"2025-03-02T16:37:17.847Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pfnet.png","metadata":{"files":{"readme":"README.rst","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":"2012-12-18T03:58:29.000Z","updated_at":"2018-01-15T05:13:10.000Z","dependencies_parsed_at":"2022-09-11T12:31:41.360Z","dependency_job_id":null,"html_url":"https://github.com/pfnet/jsonconfig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pfnet/jsonconfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjsonconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjsonconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjsonconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjsonconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pfnet","download_url":"https://codeload.github.com/pfnet/jsonconfig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet%2Fjsonconfig/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259804841,"owners_count":22913901,"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":[],"created_at":"2024-11-13T17:06:08.230Z","updated_at":"2025-06-14T11:04:27.338Z","avatar_url":"https://github.com/pfnet.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"jsonconfig\n==========\n\n.. image:: https://travis-ci.org/unnonouno/jsonconfig.png?branch=master\n   :target: https://travis-ci.org/unnonouno/jsonconfig\n\n.. image:: https://coveralls.io/repos/unnonouno/jsonconfig/badge.png\n   :target: https://coveralls.io/r/unnonouno/jsonconfig\n\njsonconfig is a simple helper class with json object for application configuration. \n\n- simply wrap pficommon json object\n- readable error messages with jsonpath which indicates invalid configuration\n\nBuild\n-----\n\n::\n\n  $ ./waf configure \u0026 ./waf \u0026 ./waf install\n\n\nSupported Types\n---------------\n\npficommon json compatible.\n\n- bool\n- int\n- long\n- float\n- double\n- std::string\n- std::vector\n- std::map\n- pfi::data::unordered_map\n- pfi::data::optional\n\n\nExample\n-------\n\nAssume you have a configuration file like this::\n\n  { \"web_server\": {\n      \"host\": \"http://hoge.com\",\n      \"port\": 8080  },\n    \"users\": [\"saitama\", \"gumma\", \"ibaraki\"]\n  }\n\nYou can access it with `as` method::\n\n  jsonconfig::config_root config = jsonconfig::load(\"path/to/json/file\");\n  // print \"http://hoge.com\"\n  std::cout \u003c\u003c config[\"web_server\"][\"host\"].as\u003cstd::string\u003e() \u003c\u003c std::endl;\n  // print 8080\n  std::cout \u003c\u003c config[\"web_server\"][\"port\"].as\u003cint\u003e() \u003c\u003c std::endl;\n\nYou can use struct to define schema of configuration explicitly::\n\n  struct server_conf {\n    struct web_conf {\n      std::string host;\n      int port;\n\n      templpate \u003ctypename Ar\u003e\n      void serialize(Ar\u0026 ar) {\n        ar \u0026 MEMBER(host) \u0026 MEMBER(port);\n      }\n    } web_server;\n\n    std::vector\u003cstd::string\u003e users;\n\n    template \u003ctypename Ar\u003e\n    void serialize(Ar\u0026 ar) {\n      ar \u0026 MEMBER(web_server) \u0026 MEMBER(users);\n    }\n  };\n\n  server_conf server = jsonconfig::config_cast\u003cserver_conf\u003e(conf);\n\n\nLicense\n-------\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpfnet%2Fjsonconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpfnet%2Fjsonconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpfnet%2Fjsonconfig/lists"}