PHP Serialize / Unserialize

Decode PHP serialize format to JSON — or encode JSON back

Result

Free Online Tool

PHP Serialize / Unserialize — Complete Guide & Instructions

MakeCard PHP Serialize / Unserialize converts data both ways between PHP's serialize() format and human-readable JSON. Paste a string like a:2:{i:0;s:5:"apple";...} to see it expanded as clean JSON, or paste JSON to get a valid PHP serialized string back — handy for debugging WordPress options, Laravel cache entries, and database rows that store serialized blobs. Integers, floats, booleans, null, strings, and nested arrays are all supported.

How to Use PHP Serialize / Unserialize

  1. 1 Choose a direction: “Unserialize → JSON” or “JSON → Serialize”.
  2. 2 Paste the serialized string or JSON into the input box (press “Sample” for an example).
  3. 3 Click “Unserialize” or “Serialize” to convert.
  4. 4 Copy the result from the output panel with the “Copy” button.
  5. 5 Fix the error message shown if the input is malformed, then run again.

Key Features & Capabilities

  • Bidirectional conversion: PHP serialize format ↔ pretty-printed JSON.
  • Full type support: integers, doubles, booleans, null, strings and nested arrays.
  • Associative arrays become JSON objects; sequential arrays become JSON lists.
  • Handles byte-length string counts correctly (UTF-8 aware).
  • Clear error messages that point at the failing type or position.
  • Everything happens locally — serialized session or DB data never leaves your device.

Supported Formats & Specifications

Parameter Specification
Modes Unserialize → JSON, and JSON → Serialize
Supported Types i: int, d: float, b: bool, N: null, s: string, a: array (nested)
Not Supported PHP object notation (O:...) — objects are not deserialized
Output Indented JSON or valid PHP serialized string
Processing 100% in-browser, no server calls

Practical Everyday Use Cases

  • Inspecting a serialized array stored in a WordPress wp_options row.
  • Debugging Laravel or Symfony cache entries saved as serialized blobs.
  • Migrating serialized PHP data into JSON for a new API or JavaScript app.
  • Crafting a serialized string by hand for a fixture or seed file.
  • Decoding session or metadata dumps from legacy PHP applications.

Pro Tips for Best Results

  • If unserialize fails at a specific position, look for an O: token — PHP objects are not supported; strip the object entries first.
  • String lengths inside s:N:"..." count bytes, not characters — this tool handles multi-byte UTF-8 correctly, but mangled input strings will still fail.
  • When converting JSON → serialize for a database, test the output with PHP's unserialize() before writing it.
  • Associative PHP arrays map to JSON objects; numeric-keyed sequences map to JSON arrays — check your keys before round-tripping.

Common Problems & Solutions

The input contains a PHP object (O:8:"Class"...). Objects are not deserialized — convert to arrays or remove those entries.

A mismatched string length or truncated input breaks the format. Re-copy the full serialized string including the closing braces.

The input must be valid JSON — check for trailing commas, single quotes, or undefined values before serializing.

Privacy & Security

100% Client-Side Execution

All conversion happens in your browser — serialized data, which can contain session or user information, is never transmitted anywhere.

No server uploads No data logging Safe for personal documents
FAQ Section

Frequently Asked Questions

Everything you need to know about using PHP Serialize / Unserialize

Something like a:2:{i:0;s:5:"apple";i:1;i:42;} — each value is prefixed by a type letter (a=array, s=string, i=int) with lengths and delimiters. This tool expands it to readable JSON.

No — object notation (O:...) is not supported. Arrays, strings, numbers, booleans and null all work, nested as deep as needed.

Switch to “JSON → Serialize”, paste valid JSON, and the tool emits the equivalent a:/s:/i: format you can store or use in PHP.

Most failures come from truncated input or a wrong byte count in s:N:"..." — copy the complete string exactly as stored.

No — parsing and conversion run locally in your browser only.

Related FreeToolsBazaar Tools

Ready to Use PHP Serialize / Unserialize?

100% free, browser-based, and private. No installation, registration, or file upload to external servers required.

Start Using PHP Serialize / Unserialize