PHPackages                             aelzakzouk/js-object-to-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. aelzakzouk/js-object-to-json

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

aelzakzouk/js-object-to-json
============================

PHP library to convert a JavaScript object string to JSON formatted string

1.1(2y ago)08.9kMITPHPPHP ^7.0 || ^8.0

Since Dec 12Pushed 2y agoCompare

[ Source](https://github.com/aelzakzouk/js-object-to-json)[ Packagist](https://packagist.org/packages/aelzakzouk/js-object-to-json)[ Docs](https://github.com/ovidigital/js-object-to-json)[ RSS](/packages/aelzakzouk-js-object-to-json/feed)WikiDiscussions master Synced 1mo ago

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

ovidigital/js-object-to-json
============================

[](#ovidigitaljs-object-to-json)

###### PHP library to convert a JavaScript object string to JSON formatted string

[](#php-library-to-convert-a-javascript-object-string-to-json-formatted-string)

[![Latest Version](https://camo.githubusercontent.com/a34dfdc0e191d90e653aa6bd52533b2ae00bb957c007c9b6ad2624cddb1e48ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f76696469676974616c2f6a732d6f626a6563742d746f2d6a736f6e2e7376673f616368655365636f6e64733d33363030266c6162656c3d6c617465737425323076657273696f6e)](https://github.com/ovidigital/js-object-to-json/releases)[![Build Status](https://github.com/ovidigital/js-object-to-json/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/ovidigital/js-object-to-json/actions/workflows/ci.yml?query=branch%3Amaster)[![codecov](https://camo.githubusercontent.com/9bffa3f0e44818730f8c4ad1c66ab4279de8ea691ac87fcbcd4580dde1a04e63/68747470733a2f2f636f6465636f762e696f2f67682f6f76696469676974616c2f6a732d6f626a6563742d746f2d6a736f6e2f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d594d4b4c563633505441)](https://codecov.io/gh/ovidigital/js-object-to-json)

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

[](#installation)

```
composer require ovidigital/js-object-to-json
```

Usage
-----

[](#usage)

```
// A variable containing a JavaScript object as a string
$jsObjectString = "{ foo:  'bar' }";

// Convert the JavaScript object to JSON format
$json = \OviDigital\JsObjectToJson\JsConverter::convertToJson($jsObjectString);

// Alternatively convert the JavaScript object to a PHP array
$phpArray = \OviDigital\JsObjectToJson\JsConverter::convertToArray($jsObjectString);
```

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

[](#contributing)

Feel free to submit a pull request or create an issue.

License
-------

[](#license)

This project is licensed under the terms of the MIT license.

Check the [LICENSE.md](LICENSE.md) file for license rights and limitations.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.9% 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 ~0 days

Total

2

Last Release

881d ago

### Community

Maintainers

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

---

Top Contributors

[![ovidyou](https://avatars.githubusercontent.com/u/1453063?v=4)](https://github.com/ovidyou "ovidyou (35 commits)")[![vanodevium](https://avatars.githubusercontent.com/u/16780069?v=4)](https://github.com/vanodevium "vanodevium (5 commits)")[![bradietilley](https://avatars.githubusercontent.com/u/44430471?v=4)](https://github.com/bradietilley "bradietilley (4 commits)")[![aelzakzouk](https://avatars.githubusercontent.com/u/135509834?v=4)](https://github.com/aelzakzouk "aelzakzouk (3 commits)")[![mytryk](https://avatars.githubusercontent.com/u/327183?v=4)](https://github.com/mytryk "mytryk (1 commits)")

---

Tags

jsonjavascriptJSobject

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aelzakzouk-js-object-to-json/health.svg)

```
[![Health](https://phpackages.com/badges/aelzakzouk-js-object-to-json/health.svg)](https://phpackages.com/packages/aelzakzouk-js-object-to-json)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[ovidigital/js-object-to-json

PHP library to convert a JavaScript object string to JSON formatted string

18177.7k6](/packages/ovidigital-js-object-to-json)[colinodell/json5

UTF-8 compatible JSON5 parser for PHP

30422.2M45](/packages/colinodell-json5)[ergebnis/json-printer

Provides a JSON printer, allowing for flexible indentation.

9138.2M24](/packages/ergebnis-json-printer)[ergebnis/json-normalizer

Provides generic and vendor-specific normalizers for normalizing JSON documents.

8237.5M6](/packages/ergebnis-json-normalizer)[ergebnis/json

Provides a Json value object for representing a valid JSON string.

2421.7M8](/packages/ergebnis-json)

PHPackages © 2026

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