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

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

pxgamer/json-g
==============

A PHP implementation of JSON-G.

v2.2.0(4y ago)19MITPHPPHP ^7.4 || ^8.0

Since Oct 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/pxgamer/php-json-g)[ Packagist](https://packagist.org/packages/pxgamer/json-g)[ Fund](https://ecologi.com/owenvoke?gift-trees)[ GitHub Sponsors](https://github.com/owenvoke)[ RSS](/packages/pxgamer-json-g/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (3)Versions (8)Used By (0)

PHP JSON-G
==========

[](#php-json-g)

[![Latest Version on Packagist](https://camo.githubusercontent.com/11d74820261165a369a6eb2f506869c9dab10e71b8509955975b66aa52f67cd7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f707867616d65722f6a736f6e2d672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pxgamer/json-g)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/f2a7bf01b20aa595c980d6cd4abb26147b4e1fecfbab68d45e6cc37ff6fc2733/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f707867616d65722f7068702d6a736f6e2d672f54657374732e7376673f7374796c653d666c61742d737175617265)](https://github.com/pxgamer/php-json-g/actions)[![Style CI](https://camo.githubusercontent.com/9ac784a6b8b30a80c25bcb7b212aae0751b709a1ec105913bfa2824fe7bb2843/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130373637393533312f736869656c64)](https://styleci.io/repos/107679531)[![Total Downloads](https://camo.githubusercontent.com/0741dd95c3c9a81a7edefaf1fbd4d6d1265dde1806a382b21d8a1b347f70e81e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f707867616d65722f6a736f6e2d672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pxgamer/json-g)[![Buy us a tree](https://camo.githubusercontent.com/910e097fe46a40add8f3484705ecbc26dc047df84b2fef027405f47408023d76/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e3f7374796c653d666c61742d737175617265)](https://ecologi.com/owenvoke?gift-trees)

A PHP implementation of [JSON-G](https://github.com/Roadcrosser/JSON-G).

Install
-------

[](#install)

Via Composer

```
$ composer require pxgamer/json-g
```

Usage
-----

[](#usage)

Use the `JsonG::toImageBlob()` or `JsonG::toJson()` to convert between a blob and JSON-G.

#### Examples

[](#examples)

**Converting an image via POST**

```
use RaidAndFade\JsonG\JsonG;

$base64 = base64_decode($_POST['in']);

$image = new Imagick();
$image->readimageblob($base64);

$json = JsonG::toJson($image);

header("Content-Type: text/json");
echo $json;
```

**Converting a JSON-G string to image via POST**

```
use RaidAndFade\JsonG\JsonG;

$jsonArray = json_decode($_POST['in'], true);

$image = JsonG::toImageBlob($jsonArray);

header("Content-Type: image/png");
echo $image;
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Owen Voke](https://github.com/owenvoke)
- [RaidAndFade](https://git.gocode.it/RaidAndFade/PHP_json-g)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Treeware
--------

[](#treeware)

You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees [here](https://ecologi.com/owenvoke?gift-trees).

Read more about Treeware at [treeware.earth](https://treeware.earth).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity73

Established project with proven stability

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

Recently: every ~386 days

Total

7

Last Release

1549d ago

Major Versions

v1.0.0 → v2.0.02017-11-08

PHP version history (3 changes)v2.0.0PHP ^7.1

v2.1.0PHP ^7.2

v2.2.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1899334?v=4)[Owen Voke](/maintainers/owenvoke)[@owenvoke](https://github.com/owenvoke)

---

Tags

composerjson-gphp7

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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