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

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

sgoendoer/json
==============

Simple JSON for PHP

0.2.1(10y ago)2911MITPHP

Since Dec 2Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sgoendoer/json)[ Packagist](https://packagist.org/packages/sgoendoer/json)[ RSS](/packages/sgoendoer-json/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)DependenciesVersions (7)Used By (1)

json
====

[](#json)

JSON for PHP

Setup
-----

[](#setup)

```
./composer require sgoendoer/json

```

or configure your composer.json accordingly

```
"require" : { "sgoendoer/json": "0.2.*" }

```

Usage
-----

[](#usage)

```
    use sgoendoer\json\JSONObject;
    use sgoendoer\json\JSONArray;

    $jsonObject = new JSONObject();

    $jsonObject->put("key", "value");
    $jsonObject->put("array", new JSONArray());
    $jsonObject->put("object", new JSONObject('{"a", 1}'));

    echo $jsonObject->get("key");
    echo $jsonObject->write();

    $phpStyleJSON = $jsonObject->toStdClass();
    echo $phpStyleJSON->key;
    echo json_encode($phpStyleJSON);
```

JSONObject
----------

[](#jsonobject)

- public function \_\_construct($param = NULL, $keys = NULL)
- public function get($key)
- public function put($key, $value)
- public function opt($key)
- public function has($key)
- public function remove($key)
- public function keys()
- public static function quote($string)
- public static function stringToValue($string)
- public static function valueToString($value)
- public static function numberToString($number = NULL)
- public static function testValidity($object)
- public function toJSONArray($names = NULL)
- public function toStdClass()
- public function write()
- public function \_\_toString()

JSONArray
---------

[](#jsonarray)

- public function \_\_construct($param = NULL)
- public function get($key)
- public function put($value, $key = NULL)
- public function opt($key)
- public function remove($index)
- public function keys()
- public function toJSONObject($names)
- public static function testValidity($object)
- public function toArray()
- public function write()
- public function \_\_toString()

JSONTools
---------

[](#jsontools)

- public static function getJSONErrorAsString()
- public static function containsValidJSON($string)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 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 ~10 days

Recently: every ~5 days

Total

6

Last Release

3811d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1579152?v=4)[SebastianGoendoer](/maintainers/sgoendoer)[@sgoendoer](https://github.com/sgoendoer)

---

Top Contributors

[![sgoendoer](https://avatars.githubusercontent.com/u/1579152?v=4)](https://github.com/sgoendoer "sgoendoer (32 commits)")

### Embed Badge

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

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

###  Alternatives

[optimus/heimdal

122335.3k5](/packages/optimus-heimdal)[b13/host-variants

Extends the base variants condition with current host.

35337.6k5](/packages/b13-host-variants)[phpinnacle/buffer

PHPinnacle binary buffer implementation

2498.3k11](/packages/phpinnacle-buffer)

PHPackages © 2026

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