1.2.1 • Published 4 years ago

@holiday_peng/json-editor v1.2.1

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

json-editor

A json editor based on react and antd.

How to Use

  1. npm install @holiday_peng/json-editor

  2. create a schema like this: If you are not sure the key name, use '*' to be the placeholder, the editor will fill it after read the value.

var schema = {
  children: [
    {
      keyName: '*',
      key: 0,
      type: 'arr',
      repeatable: true,
      children: [
        {
          key: 0,
          type: 'obj',
          repeatable: true,
          father: null,
          children: [
            {
              key: 'topicId',
              label: 'Topic Id',
              type: 'str',
              father: null,
              value: '',
            },
            {
              key: 'iconUrl',
              label: 'Icon Url',
              type: 'str',
              father: null,
              value: '',
            },
            {
              key: 'displayName',
              label: 'Display Name',
              type: 'str',
              father: null,
              value: '',
            },
          ],
        },
      ],
    },
  ],
};
  1. because the editor was built based on react and antd, it has to be used in a react project like this:
import React from 'react';
import Editor from '@holiday_peng/json-editor';

class JSONEditor extends React.Component {
  render() {
    const EditorIns = new Editor(schema).init();
    return (
      <div className='editor-wrapper'>
        <EditorIns/>
      </div>
    );
  }
}
export default JSONEditor;
1.2.0

4 years ago

1.2.1

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago