{"id":19700524,"url":"https://github.com/draftbit/variable-json","last_synced_at":"2025-02-27T12:40:07.527Z","repository":{"id":72463220,"uuid":"289112523","full_name":"draftbit/variable-json","owner":"draftbit","description":"JSON syntax with variable interpolation","archived":false,"fork":false,"pushed_at":"2024-11-01T20:45:34.000Z","size":343,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T12:11:24.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"ReScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/draftbit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-08-20T21:16:25.000Z","updated_at":"2024-11-01T20:45:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f15ce56-2a16-472a-8469-7d1f942132e8","html_url":"https://github.com/draftbit/variable-json","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/draftbit%2Fvariable-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/draftbit%2Fvariable-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/draftbit%2Fvariable-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/draftbit%2Fvariable-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/draftbit","download_url":"https://codeload.github.com/draftbit/variable-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241014212,"owners_count":19894210,"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-11T21:06:19.361Z","updated_at":"2025-02-27T12:40:07.508Z","avatar_url":"https://github.com/draftbit.png","language":"ReScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VJson: JSON with variables\n\nThis defines a superset of JSON, with the addition of \"variables\"\nwhich appear between curly braces (e.g. `{{someVariable}}`). The\nformat of the variables can be customized by the user, although by\ndefault it will parse an alphanuxmeric identifier which can start with\na letter or underscore and subsequently contain any letter, digit or\n`_`. Although by default variables are strings, the `vjson` type is\npolymorphic and the structure can be mapped over to support more\ncomplex information.\n\n```json\n{\n  \"id\": {{id}},\n  \"color\": {{color}},\n  \"allSizes\": [\"small\", \"medium\", \"large\"],\n  \"size\": {{size}},\n}\n```\n\nThis library provides tools for:\n\n* Parsing the above syntax, including custom variable formats\n* Finding the set of variables in a given tree\n* Replacing all of the variables in a tree with JSON, producing a JSON object\n\n## Example\n\n```reason\nlet vJson: VJson.t(string) = VJson.parseDefault(\"{\n  \\\"id\\\": {{id}},\n  \\\"color\\\": {{color}},\n  \\\"allSizes\\\": [\\\"small\\\", \\\"medium\\\", \\\"large\\\"],\n  \\\"size\\\": {{size}},\n}\")-\u003eBelt.Result.getExn;\n\n// Prints \"Set { 'id', 'color', 'size' }\"\nJs.log(vJson-\u003eVJson.findVariables);\n\n// Customizing the variable format to integers\nlet vJsonWithInts: VJson.t(int) = VJson.(\n    \"{{123}}\"\n    |\u003e VJson.parseWithRegex([%re {|/\\d+/|}])\n    |\u003e Belt.Result.getExn\n  )\n  -\u003eVJson.map(int_of_string)\n```\n\n# Build\n```\nyarn re:build\n```\n\n# Watch\n\n```\nyarn re:watch\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdraftbit%2Fvariable-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdraftbit%2Fvariable-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdraftbit%2Fvariable-json/lists"}