PHPackages                             daverandom/exceptional-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. daverandom/exceptional-json

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

daverandom/exceptional-json
===========================

JSON encoding and decoding that throws exceptions on failure

v1.0.4(7y ago)321.4M—3.5%4[1 PRs](https://github.com/DaveRandom/ExceptionalJSON/pulls)9MITPHPPHP &gt;=7.0

Since May 4Pushed 7y ago3 watchersCompare

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

READMEChangelog (4)DependenciesVersions (6)Used By (9)

Exceptional JSON
================

[](#exceptional-json)

[![Build Status](https://camo.githubusercontent.com/6a2f713f672972fc98a04aac4c535695b9c90822a4b43d5055cae2c15c025ad6/68747470733a2f2f7472617669732d63692e6f72672f4461766552616e646f6d2f457863657074696f6e616c4a534f4e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/DaveRandom/JOM)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/85639a3136f2b2d56f45c0333868856517d73e85689050745bea9d8326f749f6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4461766552616e646f6d2f457863657074696f6e616c4a534f4e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/DaveRandom/JOM/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/5ab53de08ee94891eaab449a0918ff0aec3452e55b0893fa2617172915cbea7f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4461766552616e646f6d2f457863657074696f6e616c4a534f4e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/DaveRandom/JOM/?branch=master)[![Packagist](https://camo.githubusercontent.com/b0771d69ff9953647d4f8fe3e52ec87bb1e246e83df0b30bf612efaf1b099069/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461766572616e646f6d2f657863657074696f6e616c2d6a736f6e2e737667)](https://packagist.org/packages/daverandom/exceptional-json)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/DaveRandom/ExceptionalJSON/blob/master/LICENSE)

Thin wrapper around PHP's `json_encode()` and `json_decode()` functions, which throws exceptions when an operation fails.

### Required PHP Version

[](#required-php-version)

- PHP 7.0+

### Installation

[](#installation)

```
$ composer require daverandom/exceptional-json
```

### Usage

[](#usage)

Call the `\ExceptionJSON\encode()` and `\ExceptionJSON\decode()` functions in exactly the same way as you would with `json_encode()` and `json_decode()`. The only difference is that they will throw an exception if the operation fails.

Also defines `json_try_encode()` and `json_try_decode()` in the root namespace if they don't already exist, these are simply aliases of their namespaced counterparts.

```
$encoded = \ExceptionJSON\encode($data);
$decoded = \ExceptionJSON\decode($encoded);
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity62

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

Every ~192 days

Total

5

Last Release

2898d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb9d79bcd4c3c02b52daba8a5371a4d710286d9b7472c8d922008c48999d76b9?d=identicon)[DaveRandom](/maintainers/DaveRandom)

---

Top Contributors

[![DaveRandom](https://avatars.githubusercontent.com/u/2396425?v=4)](https://github.com/DaveRandom "DaveRandom (18 commits)")

### Embed Badge

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

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

###  Alternatives

[shjia/taobao_spider

淘宝、天猫商品爬虫

161.2k](/packages/shjia-taobao-spider)

PHPackages © 2026

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