@rhidium/json-editor
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published
logo

Font_PNG

Discord server npm version npm downloads

@rhidium/json-editor

This is a simple, web-based JSON editor for our Discord bots, but it can be used with any JSON schema. It is only meant to be used locally and is merely intended as a convenient solution for our users that aren't familiar with JSON.

When a JSON is saved locally, a backup will be created of the original file (if is exists) before it is created.

Using the editor

Install the package: npm i @rhidium/json-editor

And start the express app:

scripts/json-editor.js

// CommonJS
const { startJSONEditor } = require('@rhidium/json-editor')
const { readFileSync } = require('fs')
// ESM
import { startJSONEditor } from '@rhidium/json-editor'
import { readFileSync } from 'fs'

const jsonSchema = readFileSync('./config.schema.json', 'utf-8');

startJSONEditor({
  port: 3000,
  dataFilePath: './config.json',
  data: {}, // Default data, if not read from file
  createBackup: true,
  schemaString: jsonSchema
}, {
  // Some additional editor options
  // All native @json-editor/json-editor options are available
  // These are our defaults
  theme: 'bootstrap5',
  iconlib: "fontawesome5",
  disable_collapse: false,
  disable_edit_json: true,
  disable_properties: true,
  no_additional_properties: true,
})

And start the script: node scripts/json-editor.js

Package Sidebar

Install

npm i @rhidium/json-editor

Weekly Downloads

2

Version

1.0.2

License

none

Unpacked Size

35.1 kB

Total Files

10

Last publish

Collaborators

  • rhidium