{"id":25714108,"url":"https://github.com/diffcunha/jsonmltoreact","last_synced_at":"2025-05-01T12:21:40.089Z","repository":{"id":57146622,"uuid":"58964871","full_name":"diffcunha/jsonmltoreact","owner":"diffcunha","description":"JsonML to React component converter","archived":false,"fork":false,"pushed_at":"2018-04-26T21:05:33.000Z","size":18,"stargazers_count":9,"open_issues_count":1,"forks_count":6,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-14T10:18:57.957Z","etag":null,"topics":["jsonml","react","react-converter"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/diffcunha.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":"2016-05-16T20:22:41.000Z","updated_at":"2023-10-15T07:12:14.000Z","dependencies_parsed_at":"2022-08-29T19:40:34.462Z","dependency_job_id":null,"html_url":"https://github.com/diffcunha/jsonmltoreact","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffcunha%2Fjsonmltoreact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffcunha%2Fjsonmltoreact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffcunha%2Fjsonmltoreact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffcunha%2Fjsonmltoreact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diffcunha","download_url":"https://codeload.github.com/diffcunha/jsonmltoreact/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251872374,"owners_count":21657633,"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":["jsonml","react","react-converter"],"created_at":"2025-02-25T12:33:49.100Z","updated_at":"2025-05-01T12:21:40.069Z","avatar_url":"https://github.com/diffcunha.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Code Climate](https://codeclimate.com/github/diffcunha/jsonmltoreact/badges/gpa.svg)](https://codeclimate.com/github/diffcunha/jsonmltoreact)\n[![Test Coverage](https://codeclimate.com/github/diffcunha/jsonmltoreact/badges/coverage.svg)](https://codeclimate.com/github/diffcunha/jsonmltoreact/coverage)\n\n# jsonmltoreact\nJsonML to React converter\n\n## Install\n\n```shell\n$ npm i --save jsonmltoreact\n```\n\n## Examples\n\n```js\nimport _ from 'lodash';\nimport React from 'react';\nimport ReactDOMServer from 'react-dom/server';\nimport JsonmlToReact from 'jsonmltoreact';\n\n// Some random React component\nclass CustomCompoenent extends React.Component {\n  render() {\n    return (\n      \u003cdiv className=\"customCompoenentContainer\"\u003e\n        {this.props.header \u0026\u0026 \u003ch1\u003e{this.props.header}\u003c/h1\u003e}\n        {this.props.subheader \u0026\u0026 \u003ch2\u003e{this.props.subheader}\u003c/h2\u003e}\n        {this.props.children}\n      \u003c/div\u003e\n    );\n  }\n}\n\n// Create instance with custom converters\nlet jsonmlToReact = new JsonmlToReact({\n  'custom-tag': (props, data) =\u003e ({\n    type: CustomCompoenent,\n    props: { ...props, ...data },\n  }),\n  'span': props =\u003e ({\n    props: {\n      className: 'foobar'\n    }\n  })\n});\n\n// JsonML tree\nlet jsonml = [\n  'div', { class: 'container' },\n  [\n    'custom-tag', { subheader: 'bar' },\n    [\n      'span', 'content'\n    ]\n  ]\n];\n\n// Optional data to be passed to converters\nlet data = {\n  'header': 'foo',\n};\n\nlet reactComponent = jsonmlToReact.convert(jsonml, data);\n\nconsole.log(ReactDOMServer.renderToStaticMarkup(reactComponent));\n/*\n\u003cdiv class=\"container\"\u003e\n  \u003cdiv class=\"customCompoenentContainer\"\u003e\n    \u003ch1\u003efoo\u003c/h1\u003e\n    \u003ch2\u003ebar\u003c/h2\u003e\n    \u003cspan class=\"foobar\"\u003econtent\u003c/span\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n*/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiffcunha%2Fjsonmltoreact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiffcunha%2Fjsonmltoreact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiffcunha%2Fjsonmltoreact/lists"}