{"id":23909697,"url":"https://github.com/petli-full/hocon-web","last_synced_at":"2025-10-08T19:34:49.625Z","repository":{"id":63255272,"uuid":"347747921","full_name":"petli-full/hocon-web","owner":"petli-full","description":"This is a javascript HOCON parser. It was created by compiling the cpp-hocon library using emscripten compiler. It is a standalone library and can be built into applications run in Nodejs or browsers.","archived":false,"fork":false,"pushed_at":"2021-03-19T01:02:27.000Z","size":424,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-16T05:01:47.793Z","etag":null,"topics":["hocon","js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petli-full.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":"2021-03-14T20:35:22.000Z","updated_at":"2024-12-05T08:16:12.000Z","dependencies_parsed_at":"2022-11-15T22:04:59.052Z","dependency_job_id":null,"html_url":"https://github.com/petli-full/hocon-web","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petli-full%2Fhocon-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petli-full%2Fhocon-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petli-full%2Fhocon-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petli-full%2Fhocon-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petli-full","download_url":"https://codeload.github.com/petli-full/hocon-web/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240343036,"owners_count":19786625,"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":["hocon","js"],"created_at":"2025-01-05T06:25:22.417Z","updated_at":"2025-10-08T19:34:44.598Z","avatar_url":"https://github.com/petli-full.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hocon-web\n\nThis is a javascript HOCON parser. It was created by compiling the [cpp-hocon](https://github.com/puppetlabs/cpp-hocon) library using [emscripten](https://emscripten.org/) compiler.\nIt is a standalone library and can be built into applications run in Nodejs or browsers.\n\n\n### install it\n\n```\nnpm install --save hocon-web\n```\n\n### run it in nodejs\n\n```\nconst hocon = require('hocon-web').hocon;\n\nhocon().then((instance) =\u003e {\n    const cfg = new instance.Config('a=b');\n    // output in HOCON format\n    console.log(cfg.toHOCON());\n    // output in JSON format\n    console.log(cfg.toJSON());\n    // remmber to delete to avoid of memory leaks\n    cfg.delete();\n});\n```\n\n### use import\n\n```\nimport { hocon } from 'hocon-web;\n\nhocon().then((instance) =\u003e {\n    const cfg = new instance.Config('a=b');\n    console.log(cfg.toJSON());\n    cfg.delete();\n});\n```\n\n### examples\n\nMore examples can be found in [example](https://github.com/petli-full/hocon-web/tree/master/example)\n\n\n### APIs\n\nCurrently, the library only exposes very simple \"high-level\" methods for easily parsing a string into HOCON or JSON text. It can be extended to expose the original API methods from [cpp-hocon](https://github.com/puppetlabs/cpp-hocon) library.\n\nHere're all the methods the library provides,\n```\n// require the library\nconst hocon = require('hocon-web').hocon;\n\n// import the library\nimport { hocon } from 'hocon-web;\n\n// get the instance: an emscripten [module object](https://emscripten.org/docs/api_reference/module.html)\nhocon().then((instance) =\u003e {\n    \n    // create a Config object which takes a JSON/HOCON text as the input\n    const cfg = new instance.Config('a=b');\n\n    // whether to render comments in the resolved string\n    setRenderComments(true);\n    \n    // whether to render the comments internally generated and used by the parser (no actual use for most apps)\n    setRenderOriginComments(true);\n\n    // whether to render spaces, indentation, and new lines\n    setRenderFormatted(true);\n\n    // resolve the input to JSON text\n    const jsonText = cfg.toJSON());\n\n    // resolve the input to HOCON text\n    const hoconText = cfg.toHOCON();\n\n    // delete the Config object to prevent memory leaks\n    cfg.delete();\n});\n```\n\n\n### limitations\nInclude (files, URLs, and classpath) does not work. They are resolved to empty string.\n\n### contributions\nWelcome to contribute to this library by sending PR's or creating issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetli-full%2Fhocon-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetli-full%2Fhocon-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetli-full%2Fhocon-web/lists"}