skillfed

php2json

Convert PHP serializer strings to JSON

php2json v0.2 111.8K downloads/30d#12,396 on PyPI2
Permissive license MIT Abandoned released

What it is and what it does

php2json is a single-function library that converts PHP serialized strings into JSON format. It wraps the conversion process to enable downstream JSON decoders (like the standard json module or ujson) to parse the data, exploiting the fact that optimized JSON parsers are significantly faster than general PHP deserialization libraries.

The package is intended for one specific use case: migrating large volumes of PHP-serialized data where performance matters. It has no runtime dependencies and operates as a thin translation layer. The library explicitly does not support PHP objects, has undefined behavior with unicode strings, and requires input array keys to be strings or easily convertible to strings.

Use it for:

  • Bulk migration of PHP session data or cached objects stored in serialized format to a modern system.
  • Converting exported PHP database records or configuration files to JSON for import into non-PHP applications.
  • High-throughput processing of archived PHP-serialized data where speed is critical and the data lacks objects or unicode.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts PHP serialized strings to JSON format, designed for fast bulk migration of PHP data by leveraging optimized JSON decoders.

No. The package is abandoned (last commit 2022-07-05, no updates since first release in 2017), has minimal adoption (2 stars), and only supports Python 2.7 and 3.6—both end-of-life versions. Unless you are maintaining legacy code tied to those exact versions and have no alternative, use a maintained PHP deserialization library or handle the conversion outside Python.

Install

php2json on PyPI

pip

pip install php2json

uv

uv add php2json

poetry

poetry add php2json

Installing php2json

Before you install

Medium install friction due to compiled wheels for specific Python versions (2.7, 3.6). Package is abandoned as of 2022-07-05 with no recent maintenance, and only 2 repository stars suggest limited adoption.

License in practice

MIT license is permissive and poses no restrictions on use, modification, or distribution in commercial or private projects.

Quickstart

pip install php2json

import php2json
result = php2json.php2json(b's:3:"foo";')
print(result)  # b'"foo"'

Package only provides wheels for Python 2.7 and 3.6; installation may fail or require compilation on other Python versions. Both versions are end-of-life.

Verify before relying

  • Whether the package works reliably with Python versions beyond 2.7 and 3.6, given the wheel availability and abandonment status.
  • Current compatibility with modern Python 3.x versions and whether deserialization behavior remains stable.
  • Whether unicode string handling limitations have been addressed or remain undefined.

Package facts

License MIT (permissive)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance abandoned — 3,223 days since the last release
Last repo commit
First released
Downloads 111,816/month — #12,396 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: php2json-0.2-cp27-cp27mu-manylinux1_x86_64.whl; php2json-0.2-cp36-cp36m-manylinux1_x86_64.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.6

Tags

php serialization to jsonconvert php serialized dataphp data migrationdeserialize php stringsphp to json converterfast php data parsing
data-migrationlegacy-format

More Utilities packages