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.2.0(2mo ago)47471.9k↓19.1%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 3d ago

READMEChangelogDependencies (14)Versions (36)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

59

—

FairBetter than 98% of packages

Maintenance83

Actively maintained with recent releases

Popularity50

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 84.6% 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 ~30 days

Recently: every ~20 days

Total

35

Last Release

86d 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://avatars.githubusercontent.com/u/11314101?v=4)[Jesús García](/maintainers/novadaemon)[@novadaemon](https://github.com/novadaemon)

---

Top Contributors

[![novadaemon](https://avatars.githubusercontent.com/u/11314101?v=4)](https://github.com/novadaemon "novadaemon (44 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)")[![olivM](https://avatars.githubusercontent.com/u/855?v=4)](https://github.com/olivM "olivM (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

[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

274326.6k8](/packages/croustibat-filament-jobs-monitor)[stephenjude/filament-debugger

About

104162.2k2](/packages/stephenjude-filament-debugger)

PHPackages © 2026

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