Skip to content

Simple online JSON editor and viewer. Includes syntax validation and dark mode for accessibility. Used to manage data structures like menu.json.

Notifications You must be signed in to change notification settings

lbettero/json-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🧩 JSON Menu Editor β€” PHP + Alpine.js (v2.0.0)

A robust, modular and extensible system for loading, editing, validating and saving multi-level menus stored in a menu.json file. Built with PHP, Alpine.js and TailwindCSS, this module now includes a visual menu editor, global field system, type-aware metadata propagation, and a fully safe JSON-saving workflow.

Ideal for dashboards, CMS-like control panels, embedded UIs or any environment that requires a structured, metadata-rich dynamic menu.

πŸ—“οΈ Version History Version Date Description v1.0.0 Initial release Basic menu JSON loading and rendering. v2.0.0 Current Major update: Global Fields, rigid propagation, field types, updated editor UI, improved saving pipeline, and JSON normalization overhaul. ✨ Highlights of Version 2.0.0 🧬 1. Global Fields System (NEW)

Define fields that automatically apply to all menu items across all levels.

Each field includes:

Field name

Field type (string, number, boolean, json)

Default value

Ability to remove fields dynamically

These fields are then shown inside every menu item of the editor.

βœ” Rigid propagation

Every item always contains all global fields.

βœ” Guidance message added

Below the Global Fields section:

β€œAfter adding or removing global fields, save the menu so that these fields appear in all items.”

πŸ“ 2. Updated Visual Menu Editor

Add/edit/remove menu items

Add siblings and nested items

Up to 3 levels

Automatic name rebuilding for nested structures

Global fields appear dynamically inside each item

Enhanced layout and accessibility

πŸ’Ύ 3. Improved JSON Saving (save-menu.php)

Now includes:

Conversion of field values according to their type

Application of Global Field schema to all items

Removal of obsolete fields

Normalization of tags

Full recursive processing

Pretty-printed JSON

Success screen with Download menu.json button

🧠 4. Architecture Improvements

Safer parsing

Cleaner PHP structure (functions, includes)

Enhanced frontend integration with Alpine.js

Item editor dynamically reacts to global field changes

πŸ“ Project Structure menu-json-editor/ β”‚ β”œβ”€β”€ assets/ β”‚ β”œβ”€β”€ data/ β”‚ β”‚ └── menu.json β”‚ β”œβ”€β”€ icons/ β”‚ └── css/ β”‚ └── main.css β”‚ β”œβ”€β”€ assets/js/ β”‚ β”œβ”€β”€ menu-editor.js ← NEW v2.0.0 β”‚ β”œβ”€β”€ dashboard.js β”‚ β”œβ”€β”€ menu.js β”‚ └── menu-manager.js β”‚ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ includes/ β”‚ β”‚ β”œβ”€β”€ header.php β”‚ β”‚ └── footer.php β”‚ └── functions/ β”‚ β”œβ”€β”€ menu.php β”‚ β”œβ”€β”€ menu-editor.php ← UPDATED v2.0.0 β”‚ └── save-menu.php ← UPDATED v2.0.0 β”‚ β”œβ”€β”€ menu-manager.php └── README.md

πŸš€ How to Run

Start a PHP server:

php -S localhost:8000

Open:

http://localhost:8000/menu-manager.php

πŸ”„ Workflow (v2.0.0)

menu.php loads JSON

menu-editor.php displays items + global fields

User edits both

Saving applies rigid schema enforcement

JSON is normalized and written to file

User may download updated menu.json

πŸ§ͺ Validation & Safety

βœ” HTML sanitized βœ” JSON validated βœ” Field type casting βœ” Rigid schema propagation βœ” Error details shown clearly

πŸ“œ Requirements

PHP 8+

No database required

Works on any hosting environment

πŸ‘©β€πŸ’» Author

Livia PΓ©rez Bettero

πŸ€– Technical Collaboration

ChatGPT (OpenAI)

About

Simple online JSON editor and viewer. Includes syntax validation and dark mode for accessibility. Used to manage data structures like menu.json.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published