How to use json-parse-better-errors - 2 common examples

To help you get started, we’ve selected a few json-parse-better-errors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / form-render / demo / main.js View on Github external
render() {
    const { theme, ...formProps } = this.props;
    const { schemaStr } = this.state;
    const FormRender = theme === 'antd' ? AntdComp : FusionComp;
    let schema = {};
    try {
      schema = parseJson(schemaStr);
    } catch (error) {
      console.log(error);
    }
    const { propsSchema = {}, uiSchema = {}, formData = {} } = schema;
    return (
      <div>
        <div>
           {}}
            className="flex flex-column"
            style={{ overflow: 'auto' }}
          &gt;
            
              </div></div>
github alibaba / form-render / demo / main.js View on Github external
tryParse = schemaStr => {
    let schema = {};
    try {
      schema = parseJson(schemaStr);
      if (typeof schema !== 'object') {
        this.setState({ error: 'schema非正确json' });
        return;
      }
      this.setState({ error: '' });
      return schema;
    } catch (error) {
      this.setState({ error: String(error) });
    }
  };

json-parse-better-errors

JSON.parse with context information on error

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Popular json-parse-better-errors functions