PHPackages                             swaggest/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. swaggest/json

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

swaggest/json
=============

JSON encoder with RAW support

v1.0.0(8y ago)13.4k↓33.3%1MITPHP

Since Nov 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/swaggest/php-json)[ Packagist](https://packagist.org/packages/swaggest/json)[ RSS](/packages/swaggest-json/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

swaggest/json
=============

[](#swaggestjson)

JSON encoder with RAW support

[![Build Status](https://camo.githubusercontent.com/0f3b407f4724c3326e9c3861b9a668e94db65535560280777a04f030f72e17c8/68747470733a2f2f7472617669732d63692e6f72672f73776167676573742f7068702d6a736f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/swaggest/php-json)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/099209ab4065688d3cb53ffefac6a4ae59824e2dcc243a752eece3d484b8ecaf/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73776167676573742f7068702d6a736f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/swaggest/php-json/?branch=master)[![Code Climate](https://camo.githubusercontent.com/bfebae5df561d61eaffc7f782a72868b283a9651e03961d0a38c86bd2c2ab6f4/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f73776167676573742f7068702d6a736f6e2f6261646765732f6770612e737667)](https://codeclimate.com/github/swaggest/php-json)

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

[](#installation)

```
composer require swaggest/json

```

Usage
-----

[](#usage)

```
$data = array(
    'val' => 'hello!',
    'callback' => new \Swaggest\Json\RawJson('function(){alert("hello!")}')
);

$json = (string)(new \Swaggest\Json\Json($data));
$this->assertSame('{"val":"hello!","callback":function(){alert(\"hello!\")}}', $json);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3099d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/27acbd2504e91c838d403112493d8ae7b584c2d8d2f2ea7a9762ef764e35bc8c?d=identicon)[vearutop](/maintainers/vearutop)

---

Top Contributors

[![vearutop](https://avatars.githubusercontent.com/u/1381436?v=4)](https://github.com/vearutop "vearutop (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/swaggest-json/health.svg)

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

###  Alternatives

[laminas/laminas-stdlib

SPL extensions, array utilities, error handlers, and more

236103.2M438](/packages/laminas-laminas-stdlib)

PHPackages © 2026

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