FORMATFYCOM formátovač · validátor · minifikátor About

What's new

PHP Serialize

Convert JSON to PHP serialize() format with correct byte lengths, optionally objects as stdClass. Free, in your browser.

Input

Output


      

How to convert JSON to PHP serialize()

Converts JSON to PHP serialize() format with correct byte lengths (UTF-8). Objects optionally as stdClass; the output works with unserialize().

  1. Paste JSON

    JSON errors are explained and fixed.

  2. Choose objects

    Associative arrays (default), or stdClass like json_decode() without true.

  3. Copy the result

    Straight into a database or PHP code.

What it does

Byte lengths

s:19:"Žluťoučký kůň" — accented characters take more bytes than characters; lengths are computed correctly.

Integer keys

Keys like "5" become i:5, exactly as PHP does.

Round-trip

JSON from PHP unserialize converts back to the same string.

FAQ

Why do string lengths break after saving to a database?

serialize() lengths are in bytes; when the database changes charset (latin1 ↔ utf8) they stop matching. PHP unserialize with “fix string lengths” repairs it.

Is it free, without sign-up?

Yes. No sign-up, no ads and no size limit — the only limit is your computer.

Is my data sent to a server?

No. Everything runs in your browser and the data you paste never leaves it — fine even for data with tokens or personal information.

Related tools