PHPackages                             novadaemon/filament-pretty-json - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. novadaemon/filament-pretty-json

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

novadaemon/filament-pretty-json
===============================

Read-only field to show pretty json in your filamentphp forms

v4.0.1(2mo ago)44359.2k—5.4%14[1 issues](https://github.com/novadaemon/filament-pretty-json/issues)2MITPHPPHP ^8.2

Since Jun 10Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/novadaemon/filament-pretty-json)[ Packagist](https://packagist.org/packages/novadaemon/filament-pretty-json)[ Docs](https://github.com/novadaemon/filament-pretty-json)[ GitHub Sponsors](https://github.com/novadaemon)[ RSS](/packages/novadaemon-filament-pretty-json/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (34)Used By (2)

novadaemon/filament-pretty-json
===============================

[](#novadaemonfilament-pretty-json)

Read-only field to show pretty json in your [filamentphp](https://filamentphp.com/) forms or infolists.

[![Screenshot](https://raw.githubusercontent.com/novadaemon/filament-pretty-json/refs/heads/main/resources/img/screenshot.webp)](https://raw.githubusercontent.com/novadaemon/filament-pretty-json/refs/heads/main/resources/img/screenshot.webp)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require novadaemon/filament-pretty-json
```

This package supports Filament 2.x, 3.x and 4.x.

Add to form
-----------

[](#add-to-form)

Simply use the component as you'd use any other Filament field. It's especially perfect for the resource view page where it blends right in.

```
use Novadaemon\FilamentPrettyJson\Form\PrettyJsonField;

class FormResource extends Resource
{
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                PrettyJsonField::make('json')
            ]);
    }
}
```

Add to infolist
---------------

[](#add-to-infolist)

Use *PrettyJsonEntry* class instead.

```
use Novadaemon\FilamentPrettyJson\Infolist\PrettyJsonEntry;

class InfoResource extends Resource
{
    public static function infolist(Infolist $infolist): Form
    {
        return $infolist
            ->schema([
                PrettyJsonEntry::make('json')
            ]);
    }
}
```

The value of the field can be casting to string, json, array, object, AsArrayObject or object that implements Jsonable interface

```
/**
 * @var string[]
 */
protected $casts = [
    'card_info' => 'string',
    // OR 'card_info' => 'json',
    // OR 'card_info' => 'array',
    // OR 'card_info' => 'object',
    // OR 'card_info' => AsArrayObject::class,
    // OR 'card_info' => CustomCast::class,
];
```

Allowing the value to be copied to the clipboard
------------------------------------------------

[](#allowing-the-value-to-be-copied-to-the-clipboard)

You may make the JSON copyable, such that clicking on the icon that appear in the top of the div when this option is enabled, the JSON value to the clipboard, and optionally specify a custom confirmation message and duration in milliseconds.

```
PrettyJsonEntry::make('card_info')
    ->copyable()
    ->copyMessage('Your JSON is copied to the clipboard')
    ->copyMessageDuration(1500)
```

[![Copyable](https://raw.githubusercontent.com/novadaemon/filament-pretty-json/refs/heads/main/resources/img/copyable.webp)](https://raw.githubusercontent.com/novadaemon/filament-pretty-json/refs/heads/main/resources/img/copyable.webp)

Customize
---------

[](#customize)

### Add extra attributes

[](#add-extra-attributes)

You can add additional attributes to the pre div using the **extraAttributes()** method.

```
PrettyJsonField::make('card')
->extraAttributes([
  'style' => 'max-height: 200px;',
]),
```

### Global customization

[](#global-customization)

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="filament-pretty-json-views"
```

Also, you can overwrite the css rules in your stylesheets.

```
.prettyjson-container {
  position: relative;
  min-width: 0;
  flex: 1;
}

pre.prettyjson {
  color: black;
  background-color: rgba(0, 0, 0, 0);
  border: 1px solid rgb(229, 231, 235);
  border-radius: 0.5rem;
  padding: 10px 20px;
  overflow: auto;
  font-size: 12px;
}

:is(.dark) pre.prettyjson {
  opacity: 0.7;
  --tw-bg-opacity: 1;
  --tw-border-opacity: 1;
  border: 1px solid rgb(75 85 99 / var(--tw-border-opacity));
  color: rgb(209 213 219 / var(--tw-text-opacity));
}

:is(.dark) pre.prettyjson span.json-key {
  color: red !important;
}

:is(.dark) pre.prettyjson span.json-string {
  color: aquamarine !important;
}

:is(.dark) pre.prettyjson span.json-value {
  color: deepskyblue !important;
}

.copy-button {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  cursor: pointer;
  color: rgb(156 163 175);
  border: none;
  outline: none;
  z-index: 50;
}

.copy-button:hover {
  color: rgb(75 85 99);
}

.copy-button:active,
.copy-button:focus {
  border: none;
  outline: none;
}
```

Contributing
------------

[](#contributing)

Contributing is pretty chill and is highly appreciated! Just send a PR and/or create an issue!

Credits
-------

[](#credits)

- [All contributors](https://github.com/novadaemon/filament-pretty-json/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance85

Actively maintained with recent releases

Popularity50

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 87.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~13 days

Total

33

Last Release

84d ago

Major Versions

v1.1.0 → v2.2.02024-05-23

v1.1.1 → v2.2.52024-08-16

v2.6.0 → v3.0.02025-08-20

v2.7.0 → v3.1.02025-08-20

3.x-dev → v4.0.02026-01-20

PHP version history (2 changes)v1.0PHP ^8.1|^8.2

v4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a2b8dbce5ab10f31ba882dcb74addce2d9ebeb24d67468882e0237b10748ad3?d=identicon)[novadaemon](/maintainers/novadaemon)

---

Top Contributors

[![novadaemon](https://avatars.githubusercontent.com/u/11314101?v=4)](https://github.com/novadaemon "novadaemon (43 commits)")[![Ercogx](https://avatars.githubusercontent.com/u/22002063?v=4)](https://github.com/Ercogx "Ercogx (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![natecarlson](https://avatars.githubusercontent.com/u/502200?v=4)](https://github.com/natecarlson "natecarlson (1 commits)")[![zmiulan](https://avatars.githubusercontent.com/u/2788819?v=4)](https://github.com/zmiulan "zmiulan (1 commits)")

---

Tags

filamentphplaraveljsonlaravelfieldFormsfilamentnovadaemonfilament-pretty-json

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/novadaemon-filament-pretty-json/health.svg)

```
[![Health](https://phpackages.com/badges/novadaemon-filament-pretty-json/health.svg)](https://phpackages.com/packages/novadaemon-filament-pretty-json)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[rawilk/filament-password-input

Enhanced password input component for filament.

52232.4k3](/packages/rawilk-filament-password-input)[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

254255.2k6](/packages/croustibat-filament-jobs-monitor)[novadaemon/filament-combobox

Side by side combobox multiselect field to use in your FilamentPHP forms

2618.1k](/packages/novadaemon-filament-combobox)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[defstudio/filament-searchable-input

A searchable autocomplete input for Filament forms

3212.4k](/packages/defstudio-filament-searchable-input)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
