# Serialize / unserialize

Canonical interactive tool: https://taskpencil.com/tools/serialize-unserialize/

Convert JSON values to PHP serialized data and supported PHP serialized values to formatted JSON. Processing stays in your browser; inputs are not transmitted or saved.

## Instructions

1. Choose Serialize for JSON to PHP, or Unserialize for PHP to JSON.

2. Paste your input or load the example, then select Convert.

3. Copy the output. Editing the input clears the previous result.

## Format and example

PHP uses type markers and UTF-8 byte lengths. For example, JSON &quot;café&quot; becomes s:5:&quot;café&quot;;. JSON objects become PHP associative arrays; JSON arrays become indexed PHP arrays.

## Limits

Supports null, booleans, finite numbers, UTF-8 strings, and arrays. PHP arrays with consecutive integer keys starting at 0 become JSON arrays; other arrays become JSON objects. An empty PHP array becomes []. Numeric JSON object keys become PHP integer keys where representable, so object/array identity and original numeric types may change on round trips. PHP objects, custom serialization, enums, references, binary strings, duplicate array keys, non-finite numbers, and unsafe integers are rejected. JSON numbers use JavaScript precision, so decimal precision beyond that range is not preserved. Limits: 1,000,000 input bytes and 100 nesting levels. This tool parses data and never executes PHP.

Reference: https://www.php.net/manual/en/function.serialize.php
