Kadben

PHP unserialize to JSON

Paste text written by PHP serialize() (from a session, a cache or a WordPress option) to read it as JSON. It is only parsed: no object is created and no code runs.

Runs in your browser. Nothing you paste or choose is uploaded.

PHP unserialize to JSON

    Add a step
    Result

      How to use it

      1. Paste the serialized text.
      2. Read the JSON: objects show their class as “__class”, protected and private properties by their names.
      3. Copy or download the JSON.

      Rules and limits

      What is read

      Limits

      Questions and answers

      Is this safe for untrusted data?

      Yes: the text is parsed by a small parser in your browser. Unlike PHP’s own unserialize(), nothing is instantiated and no magic method runs.

      Why does it say the length is wrong?

      In s:N:"…" the number N counts bytes, not characters. Text that was edited by hand or saved in another encoding often breaks this.

      What do “__reference” and “__enum” mean?

      A reference (r: or R:) points to an earlier value by its number; an enum case (E:) is shown as Class:Case. Bytes that are not UTF-8 text are shown as {"$bin": Base64}; when a private or protected property has the same name as another one, the later one gets a suffix such as “a:protected” or “a:Class:private”.

      Related tools