HACKER Q&A
📣 talkingtab

JsxToJson


Collective Project: JsxToJson

Anyone interested in collectively creating and supporting an open source JavaScript project to parse Jsx into Json?

Why: I find it much easier to reason about and read Jsx instead of JSON. Yet JSON is a much better syntax for passing data around. Goal: Develop a small project which parses JSX and generates JSON.

``` ```

JsxToJson() should produce:

```{ "Ducks": { "sound": "quack", "children": [ { "Fred": { "color": "green", "canFly": false } } ] } } ```

I suspect, but do not know, that there are many uses for such a package.

And yes, there is For example, threejs uses a syntax that could easily be converted to JSON, which could (perhaps easily) be generated by Jsx. If you are interested, contact arthurgar nospace banzo@g also no space mail.com. Or if you already have something ...


  👤 solardev Accepted Answer ✓
I think the power of JSX is in being able to mix content with code and logic. You can have loops, maps, embedded ternaries, function calls, etc. It's not all just static markup.

If you just want a data markup language... why not regular XML? Then you can easily parse it to JSON, e.g. https://codebeautify.org/xmltojson/y24f6a4c0