https://github.com/kndgy/jsx-transform
convert jsx/tsx to json and json to jsx/tsx
https://github.com/kndgy/jsx-transform
ast json json-conversion jsx react tsx
Last synced: 14 days ago
JSON representation
convert jsx/tsx to json and json to jsx/tsx
- Host: GitHub
- URL: https://github.com/kndgy/jsx-transform
- Owner: Kndgy
- Created: 2023-02-18T12:23:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-04T16:34:13.000Z (about 3 years ago)
- Last Synced: 2025-10-08T09:55:25.324Z (8 months ago)
- Topics: ast, json, json-conversion, jsx, react, tsx
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jsx-transform-json
Convert React components to JSON and the other way around, compatible with react typescript
```js
CreateJsx(
this is text
)
```
⇄
```js
CreateJSON({
type: "div",
props: {
className: "div-class",
style: {},
children: [
{
type: "span",
key: null,
ref: null,
props: {
className: "span-class",
style: {
color: "black"
},
children: [
"this is text"
]
}
}
]
},
key: null,
ref: null
})
```
## Supported properties
```ts
interface NodeJson {
type: string | Function;
key?: string | number | null;
ref?: any;
props: {
className: string;
style?: any;
children: Array;
};
}
```
## Install
```
npm i jsx-transform-json
```