Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Json Laravel Package

pepperfm/filament-json

pepperfm/filament-json provides Filament components for editing and displaying JSON in Laravel admin panels. It supports formatting, validation, and readable previews, making nested configuration, metadata, and API payloads easier to manage without custom UI code.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with composer require pepperfm/filament-json and confirm your Filament major matches the 5.x branch requirements. 5.0.2 is a patch release — no install changes versus 5.0.1, so existing apps only need composer update pepperfm/filament-json.
  • Look first at the README quick-start plus the entry class in src/ and the Blade view it renders. Publish views/config only if you actually need to override markup; the package ships sane defaults.
  • First use case: replace a TextEntry that dumps a json column (or a ->formatStateUsing(fn ($state) => json_encode($state, JSON_PRETTY_PRINT)) hack) with the package entry in an infolist or resource view. Point it at the attribute, pick tree or table rendering, and you get collapsible structured output without writing a custom view.
  • Because 5.0.2 restores native Filament state resolution, the most common "first try" now works: JsonEntry::make('payload') on a model with an array/json cast, or on a form field whose state is computed, renders correctly without extra normalization.

Implementation Patterns

  • Pick render mode by payload size. Inline for small, flat-ish payloads you want visible in the record page; modal or drawer for large nested documents or when the entry sits inside a table row where vertical space is scarce. All three modes share the same normalization path, so you can switch modes per-resource without behavioural surprises.
  • Choose tree vs table deliberately. Tree suits arbitrary nested objects; table suits an array of similarly-shaped records (API responses, event payloads, line items). Data that is a list of scalars renders better as a tree.
  • Let Filament compute state, don't pre-compute it. Use ->state(...), ->getStateUsing(...), ->default(...), or a relationship path (customer.settings) directly on the entry. As of 5.0.2 the package resolves state through Filament first and only then normalizes, so separators (dot notation) and state caching behave as they do for any other entry. Delete any workarounds that manually called state() or pre-encoded values before passing them in.
  • Feed raw JSON strings straight from the database. Columns typed json/text that hold a JSON string no longer need a cast or json_decode in the entry. Valid JSON decodes into tree/table content; invalid JSON falls back to rendering as a scalar string, which is a useful safety net for legacy/dirty rows.
  • Mix with Arrayable/collections in computed state. Returning an Eloquent model, a collection, or a DTO implementing Arrayable from getStateUsing() is supported — good pattern for "show the serialized shape of this resource" panels without duplicating cast logic.
  • Falsy values are legitimate content now. false, 0, "0", and "" render instead of disappearing. Useful for feature-flag/config inspector screens where "off" is meaningful information; you can stop writing ?? '—' shims inside formatStateUsing.
  • Reserve filterNullable() for actual nulls. It now removes only null entries. Use it to strip absent keys from sparse API payloads, and not as a general "hide empty values" switch — pair it with an explicit callback if you also want to hide empty strings or zeroes.
  • Table/infolist integration. Group the entry in a Section or Tab alongside metadata entries, and gate it behind ->visible(fn ($record) => filled($record->payload)) (checking for null, not emptiness) so records without JSON don't show an empty shell.
  • Testing. Livewire/Filament component tests asserting on rendered content work for scalar and small structured states; the release adds regression coverage for computed state, raw JSON strings, and render-mode combinations, so mirror those cases when writing your own feature tests.

Gotchas and Tips

  • Ambiguous raw strings get decoded. A scalar string that happens to be valid JSON ("true", "123", "null", a quoted string) will parse into structure rather than render literally. If a column genuinely stores JSON-encoded scalars — very common for settings values of type string — wrap them at the source (e.g. encode into an object {"value": "123"}) or skip this entry for that attribute.
  • filterNullable() behaviour changed in 5.0.2. If you relied on it to drop "", 0, or false, those values will now appear. Audit every call site during the upgrade; this is the only change in the release with visible output differences.
  • Remove state-resolution workarounds. Code that decoded JSON in getStateUsing() and then passed an array, or that reached into the entry's state after mount, can now double-normalize or bypass Filament's caching. Prefer the plain attribute path and let the package handle decoding.
  • Empty vs null visibility. ->visible() on filled($state) evaluates "0" as empty in some helpers — use !== null when the state may legitimately be a falsy JSON value, otherwise you hide exactly the content this release added support for.
  • Debugging blank renders. dump()/dd() the value inside getStateUsing() first; if the state is a valid structure but the pane is empty, check whether a custom ->view() or a published (stale) Blade view is overriding the hardened default — republish or delete the override after upgrading.
  • Arrayable is trusted; plain objects aren't. Objects implementing Arrayable/JsonSerializable convert cleanly. Arbitrary value objects or stdClass graphs may need an explicit cast in getStateUsing().
  • Large payloads. Normalization and Blade rendering happen per-render; deeply nested documents or thousands of nodes render slowly inline, especially inside table rows. Prefer modal/drawer, and consider trimming the state before display for very large columns.
  • Extension points. Custom view via ->view(), plus any publishable config for defaults such as render mode and depth. Keep overrides minimal — 5.0.2's fixes live in the normalization path and Blade view, so a fork of the markup will silently miss future hardening.
  • CI expectations for contributors. The 5.x branch now runs tests and PHP code-style checks on GitHub Actions; run the project's formatter (Pint) and full test suite before opening a PR, since style failures will block the workflow.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect