Convert JSON Object to JSX.
npm install json-to-jsx
var json2jsx = require('json-to-jsx')
, jsx = json2jsx({ 'componentName': 'Root' });
console.log(jsx);
output:
{
<Root></Root>
}
2 space indentation is default. Change it by adding a numeric argument to json2jsx
.
var html = json2jsx(object, 4);