An open API service indexing awesome lists of open source software.

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

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
```