- What is invaders-xx/filament-jsoneditor and what does it do?
- It is a Filament form field that wraps the jsoneditor front-end library in an Alpine and JavaScript component with a Blade view. It gives you syntax highlighting, inline syntax feedback, and a tree or code editing experience for raw JSON directly inside Filament admin panels. It is purely a presentation-layer component: it has no opinion on persistence, so the value round-trips as a JSON string and all validation stays in your Laravel code.
- Which Filament and Laravel versions does this JSON editor field support?
- The package targets PHP 8.1 or newer, Laravel 10 and 11, Filament v3, and Livewire 3. It is coupled to the Filament major version because the view and asset registration rely on Filament v3 APIs such as FilamentAsset, so a v3 to v4 upgrade is likely to require changes. Pin the Filament constraint in your composer.json and verify the field against your exact minor before rolling it out.
- How do I install and register the JSON editor field in a Filament panel?
- Install it with composer require invaders-xx/filament-jsoneditor, register the package assets for your panel (on Filament v3 that is the FilamentAsset registration step), then call the field inside your resource form schema like any other component. There are no migrations, no service classes, and no server-side dependency to configure. Realistic effort for a happy path is one to three engineer-days, most of it spent on validation strategy, CSP review, and browser-level tests.
- Does the JSON editor validate JSON, and how should I enforce schema rules server-side?
- The editor provides syntax-level feedback only; it does not validate your business rules or a JSON schema. Use Laravel's json validation rule for syntax and add a schema check, for example opis/json-schema, on the server when the payload has a defined contract. Treat the client-side feedback as user experience, never as a security or correctness boundary.
- How is the JSON value stored in the database with this field?
- The field value round-trips as a plain JSON string, so it fits naturally into a json or text column, and you can additionally cast to array or AsArrayObject while keeping the string as the canonical field value. Because the stored shape is unchanged there is no data backfill when adopting or removing the package. Rolling back to a plain textarea or a code-editor field is a one-line component change.
- Does the JSON editor work with Livewire DOM morphing and deferred or lazy fields?
- Editor instances versus Livewire DOM morphing is a known fragility class, so harden the component with wire:ignore-style handling and test repeated saves carefully. Test specifically on deferred and lazy fields, and confirm the editor state survives validation errors that re-render the form. Browser-level tests with Dusk or Playwright covering edit, save, and reload are the cheapest insurance here.
- Do I need Node and Vite to build assets for this package?
- Distribution relies on prebuilt assets shipped in the package's resources/dist directory, so a normal Composer install works without a Node toolchain. You only need Node and Vite if you fork the package, customize the editor theme, or change the bundled options. Confirm that the released assets are version-tagged to match the tag you install so your built files never drift from the PHP code.
- Is this JSON editor safe for untrusted admin input, and what about CSP?
- The bundled jsoneditor library ships file import and other affordances that should be explicitly disabled for untrusted admin input. Review your Content Security Policy carefully: check whether the editor needs unsafe-eval and whether it spawns blob workers, since both can break under a strict CSP. Host the assets locally with SRI where possible, and treat the CSP and asset review as a required gate before production rollout.
- How does the field handle large JSON documents and performance?
- Multi-megabyte documents will degrade browser performance, so cap payload size and consider a plain textarea or a lighter code editor for very large records. Deeply nested documents also make the tree view harder to navigate and slower to initialize. A short spike in a scratch panel with a representative worst-case payload is the fastest way to establish your practical limits.
- Is invaders-xx/filament-jsoneditor actively maintained, and what are the alternatives?
- The package has a single maintainer, roughly 25 stars, zero dependents, and a single release in February 2025, so treat it as a vendored dependency you may have to own. Pin the version, budget a small amount of maintenance per quarter, and wrap it in your own field class so no resource references the vendor class directly. If that bus factor is unacceptable, the alternatives are a textarea with the json validation rule or a generic code-editor field, both of which keep the same stored JSON string.