{"id":25972150,"url":"https://github.com/mainframeos/react-json-parser","last_synced_at":"2025-03-05T00:19:48.234Z","repository":{"id":57333516,"uuid":"97603513","full_name":"MainframeOS/react-json-parser","owner":"MainframeOS","description":null,"archived":false,"fork":false,"pushed_at":"2017-12-07T13:35:06.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T16:52:40.974Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/MainframeOS.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-18T13:47:30.000Z","updated_at":"2022-11-23T13:02:00.000Z","dependencies_parsed_at":"2022-08-24T20:50:42.400Z","dependency_job_id":null,"html_url":"https://github.com/MainframeOS/react-json-parser","commit_stats":null,"previous_names":["mainframehq/react-json-parser"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainframeOS%2Freact-json-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainframeOS%2Freact-json-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainframeOS%2Freact-json-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainframeOS%2Freact-json-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MainframeOS","download_url":"https://codeload.github.com/MainframeOS/react-json-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241941204,"owners_count":20046026,"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":"2025-03-05T00:19:47.588Z","updated_at":"2025-03-05T00:19:48.213Z","avatar_url":"https://github.com/MainframeOS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-json-parser\n\nTransforms a JSX string to a JSON tree\n\n## Installation\n\n```sh\nnpm install react-json-parser\n```\n\n## CLI Usage\n\n```sh\nreact-json-parser [options]\n```\n\n### Options\n\n```\n-h, --help                     output usage information\n-V, --version                  output the version number\n-f, --file \u003cfile\u003e              JSX file to read, defaults to stdin if not set\n-o, --output \u003coutput\u003e          JSON destination file, defaults to stdout if not set\n-p, --pretty                   pretty-print JSON\n-a, --accept [component type]  only accepts the specified component type, can be used multiple times\n--no-plain-text                do not allow plain-text children    \n```\n\nWhen the `file` option is not provided, the JSX string is read from stdin, example:\n\n```sh\necho '\u003cMyComponent test /\u003e' | react-json-parser --pretty\n```\n\n## API usage\n\n### parse(code, options)\n\nParses the provided `code` string using the supported `options`:\n\n- `only: Array\u003cstring\u003e`: only accepts the provided components types, by default accepts any\n- `plainText: boolean`: allow plain-text children, defaults to `true`\n\n```js\nconst { parse } = require('react-json-parser')\nconst tree = parse(\n  '\u003cMyComponent test\u003eHello \u003cChildComponent /\u003e\u003cOtherChild\u003e\u003c/MyComponent\u003e',\n  {\n    only: ['MyComponent', 'ChildComponent'],\n    plainText: false,\n  }\n)\n// tree = {type: 'MyComponent', props: {children: [{type: 'ChildComponent'}], test: true}}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmainframeos%2Freact-json-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmainframeos%2Freact-json-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmainframeos%2Freact-json-parser/lists"}