Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rhidium/json-editor

A simple web-based JSON file editor, written in TypeScript.
https://github.com/rhidium/json-editor

configuration configuration-editor express express-handlebars handlebars json json-editor web-editor

Last synced: 3 days ago
JSON representation

A simple web-based JSON file editor, written in TypeScript.

Awesome Lists containing this project

README

        


logo

![Font_PNG](https://github.com/rhidium/core/assets/57721238/9ccc5763-8336-4d1e-8187-a738bafdc519)


Discord server
npm version
npm downloads


Core

Template

JSON Editor

Placeholder


# @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`

```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`