eslint-plugin-jsonc icon indicating copy to clipboard operation
eslint-plugin-jsonc copied to clipboard

`jsox` support

Open JounQin opened this issue 2 years ago • 3 comments

https://github.com/repetere/jsonx#readme

https://github.com/d3x0r/jsox

This maybe cover #4 at the same time.

JounQin avatar Jun 30 '22 16:06 JounQin

Thank you for posting issue.

But I still don't understand. It looks like JavaScript syntax. Do we need to process JSON to check jsonx? Haven't I reached that document yet?

import { * as jsonx } from 'jsonx';
const example_JXM_JSON = {
  component:'p',
  props:{ style:{ color:'blue' } },
  children:'hello world'
};

//Rendering React Components
jsonx.getReactElement(example_JXM_JSON); // => JSX Equivalent: <p style={{color:'blue'}}>hello world</p>

//Generating HTML strings
jsonx.outputHTML({ jsonx: example_JXM_JSON, }); // => '<p style="color:blue;">hello world</p>'

//Generating JSX strings
jsonx.outputJSX({ jsonx: example_JXM_JSON, }); // => '<p style={{color:blue,}}>hello world</p>'

//Rendering HTML Dom with React
jsonx.jsonxRender({ jsonx: example_JXM_JSON, querySelector:'#myApp', });
// <!DOCTYPE html>
//  <body>
//    <div id="myApp">
//      <p style="color:blue;">hello world</p>
//    </div>
// </body>

//you can also use the simplified syntax
const simpleJXM_JSON = {
  p:{
    props:{ style:{ color:'blue' } },
    children:'hello world'
  }
}

//or if you have an element with no props, simply use {type:children}
const superSimpleJXM = {
  ul:[
    {li:'first!'},
    {li:'second!'},
  ]
}

ota-meshi avatar Jun 30 '22 23:06 ota-meshi

Ah, I'm so sorry, actually I mean JSOX.

JounQin avatar Jul 01 '22 00:07 JounQin

I get it 😄

ota-meshi avatar Jul 01 '22 01:07 ota-meshi