Skip to main content

PHP Serialize Converter

Turn the serialize() blob sitting in your database into readable JSON.

JSON result
Your result will appear here

The serialize() format counts string lengths in BYTES, not characters — a Thai character is three bytes. This tool reads and writes by byte, where a character-counting converter corrupts the data.

Converted entirely in your browser — nothing is sent to a server.

About this tool

The PHP serialize converter reads what PHP's serialize() produced and shows it as readable JSON — and converts back the other way.

The situation people arrive with is opening a database and finding a column that looks like a:3:{s:4:"name";…}. WordPress option tables are full of them, as are older PHP CMS systems. Normally you would need a PHP process to read it, which is exactly why a browser tool earns its place.

What sets this apart from a naive converter is counting lengths in bytes. The serialize format declares each string's length up front, always in bytes. "สวัสดี" is 6 characters but occupies 18 bytes, so a converter that slices by characters returns the wrong substring and every subsequent field shifts out of alignment — which, for Thai data, means it fails essentially always.

It also preserves what the structure meant: an array whose keys aren't exactly 0, 1, 2… stays an object rather than collapsing into a list, because collapsing would throw the keys away.

How to use

  1. 1Choose a direction: serialize() → JSON, or JSON → serialize()
  2. 2Paste the value you copied out of the database
  3. 3It converts as you type, and points at the position of any syntax problem
  4. 4Use Swap to send the result back to the input and convert straight back

Frequently asked questions

What is this a:2:{...} value?
Output from PHP’s serialize(), which turns an array or object into a string so it can be stored in a database column. It is everywhere in WordPress option tables and older PHP systems.
Why does Thai text get corrupted in other converters?
The format declares string lengths in bytes, not characters. "สวัสดี" is 6 characters but 18 bytes, so a converter that slices by characters takes the wrong substring — and every field after it is then misaligned.
Does it handle PHP objects?
Yes. An O:4:"User":… value becomes a plain object with the class name kept in a __class field, since JSON has no concept of a class.
Why did my array become an object instead of a list?
A PHP array is an ordered map. If the keys are not exactly 0, 1, 2… turning it into a JSON list would silently discard them, so it stays an object and nothing is lost.
Is it safe to paste real data from a database?
Yes. Everything is converted in your browser; nothing is sent anywhere.

Related tools

PHP Array to JSON

Turn a PHP array literal into ready-to-use JSON.

JSON Formatter

Format, validate and minify JSON — for developers.

JSON ↔ YAML Converter

Convert between JSON and YAML in one click.

Base64 Encode / Decode

Encode and decode Base64, UTF-8 safe.