FormatterHQ

JSON Serialize Online

Serialize a JSON document into the compact form that travels over the network or into storage, with its size in bytes, or as an escaped string for a field that holds JSON.

Input JSON
Output JSON
Ready.

How to use the JSON Serialize Online

  1. Paste or upload the JSON document you want to serialize, or click Sample.
  2. Leave Wrap as escaped string literal off for plain compact JSON, or turn it on when the result must go inside another JSON string.
  3. Click Serialize and read the size in the status bar.
  4. Copy or download the serialized output.

What JSON serialize means here

Serialization is the step that turns in-memory data into a sequence of bytes you can send or store. For JSON, that sequence is the text itself, written without any optional whitespace. This JSON serialize tool parses your document and writes it back in exactly that form, the same output a program produces with JSON.stringify(value) before putting it on a socket, in a queue or in a cache.

Example

A pretty-printed document with some unusual number notation:

{
  "sku": "A-1",
  "price": 10.50,
  "qty": 1e2,
  "tags": [ "new" ]
}

Serialized, with the status bar reporting "Serialized 51 B":

{"sku":"A-1","price":10.5,"qty":100,"tags":["new"]}

Two things happened beyond removing whitespace. Numbers are written in their shortest form, so 10.50 becomes 10.5 and 1e2 becomes 100. Escapes that are not required, such as a \u00e9 sequence for é, are replaced by the character itself. The data is unchanged; only its spelling is normalized, which is what a real serializer does after parsing.

Wrap as escaped string literal

Some formats carry JSON inside a string field: an event envelope with a "payload" property, a job queue that stores arguments as text, or a database column read by an ORM as a string. Tick Wrap as escaped string literal and the compact JSON is serialized a second time:

"{\"sku\":\"A-1\",\"price\":10.5,\"qty\":100,\"tags\":[\"new\"]}"

That value can be pasted as-is into another JSON document. The size in the status bar grows accordingly (65 B here) because each quote now needs a backslash.

Why check the size?

Many transports have hard limits on message size, and the limit is counted in bytes, not characters. The size shown is the UTF-8 byte length of the output, so accented letters and emoji count as two to four bytes each. Comparing it with the limit of your queue, cookie or header before sending saves a round of debugging.

What serialization does not do

  • Key order is preserved as written; keys are not sorted. Use the JSON sorter first if you need a stable order for hashing or diffs.
  • Invalid JSON is rejected with a line and column, since there is nothing to serialize. Repair it before serializing.
  • Large integers above 253 are rounded by the parser. Send 64-bit IDs as strings.

To reverse the process, paste the output into JSON Deserialize. For a readable one-line form with spaces, see JSON to One Line.

Everything runs in the browser, and your payload is not uploaded unless you use Load URL or Save & Share.

Frequently asked questions

Is serializing JSON the same as minifying it?
The output is the same compact text. Serializing also reports the size in bytes and can wrap the result as an escaped string literal for use inside another JSON field.
Why did 10.50 become 10.5?
The document is parsed into numbers and written back in their shortest form, as every JSON serializer does. 10.50 and 10.5 are the same number, so no information is lost. If trailing zeros matter, store the value as a string.
Does serialization sort the keys?
No. Keys stay in the order they appear in your input. Sort them first with a JSON sorter if you need canonical output for signatures or caching.
Is the byte count exact?
Yes. It is the UTF-8 byte length of the output text, which is how HTTP bodies, message queues and most storage systems measure JSON.

Last updated September 26, 2026

Related tools

JSON Decode Online Decode JSON strings online. Convert escaped or encoded JSON text into readable, formatted JSON, similar to json_decode. JSON Deserialize Online Deserialize an escaped JSON payload into formatted JSON, then map it to typed objects in JavaScript, Python, Java or C# safely. JSON Encode Online JSON encode text or a document into an escaped string, with each escaping rule explained and the json_encode flags that give identical output. JSON Stringify Online Stringify JSON into an escaped string literal, exactly like JSON.stringify. Ready to embed JSON inside JSON, code or config values. JSON Sorter Sort JSON keys alphabetically at every level, ascending or descending. Optionally sort arrays of values for clean, comparable output. JSON Syntax Highlighter Syntax highlight JSON with light, dark or Monokai themes and copy the colourised HTML for blogs, docs and slides. JSON to JSONL Converter Convert a JSON array to JSON Lines (JSONL / NDJSON), one record per line, for streaming, logging, BigQuery and ML datasets. JSON to One Line Convert multi-line JSON to a single line. Collapse formatted JSON for logs, CLI arguments, environment variables and CSV cells. JSON to PHP Array Converter Convert JSON to a PHP array literal with short [] or array() syntax, ready to paste into Laravel config files, seeders and tests. JSON to String Converter Convert JSON to a single escaped string you can paste into code, databases or other JSON documents. Choose double, single or no quotes. JSON Tree Viewer Display JSON as an expandable tree. Collapse and expand objects and arrays to understand deeply nested data structures. JSON Unflatten Rebuild nested JSON from flat dot-notation keys (a.b.c) or bracket paths (a[0].b), the reverse of JSON flatten.