php2json
Convert PHP serializer strings to JSON
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 php2jsonuv
uv add php2jsonpoetry
poetry add php2jsonInstalling 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
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
phpserializeConverts Python objects to and from PHP…
permissive · top 15,000 on PyPI
jsonsConverts Python objects (dataclasses, attrs…
permissive · top 5,000 on PyPI
json-encoderProvides JSON serialization with…
unclear · top 15,000 on PyPI
ujsonUltra-fast JSON encoding and decoding in pure C…
permissive · top 1,000 on PyPI
jsonfieldA Django model field that stores and retrieves…
permissive · top 5,000 on PyPI
stanioStanIO converts Python dictionaries to…
permissive · top 5,000 on PyPI
JSON-log-formatterFormats Python logging records as JSON,…
permissive · top 5,000 on PyPI
DeepFriedMarshmallowAccelerates Marshmallow schema serialization…
permissive · top 15,000 on PyPI
simplejsonsimplejson encodes Python objects to JSON and…
permissive · top 1,000 on PyPI
SQLAlchemy-JSONFieldProvides a SQLAlchemy column type for storing…
permissive · top 5,000 on PyPI