Form URL-encoded to JSON converter

Paste a request body from browser developer tools to see the data as the server receives it in $_POST or params.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter request body and repeated names without brackets.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

The body is decoded first (+ is a space, %XX are UTF-8 bytes), then each name is split into parts: user[address][city] becomes a nested path and items[] appends a new item. A group whose keys are 0, 1, 2 in order becomes a JSON array, anything else an object.

Example

Inputs: Repeated names without brackets = Last value wins (PHP). Result: JSON: { "name": "Ali Hassan", "email": "ali@example.com", "address": { "city": "Riyadh", "zip": "12211" }, "items": [ "pen", "book" ] }; Fields: 6.

name=Ali+Hassan&email=ali%40example.com&address%5Bcity%5D=Riyadh&address%5Bzip%5D=12211&items%5B%5D=pen&items%5B%5D=book
{
  "name": "Ali Hassan",
  "email": "ali@example.com",
  "address": {
    "city": "Riyadh",
    "zip": "12211"
  },
  "items": [
    "pen",
    "book"
  ]
}

Limits and caveats

  • Values stay strings because a form carries no types.
  • Dots and spaces in names are not turned into _ the way PHP does in $_POST.

Questions about this tool

How is this different from the query string converter?

This one builds nested data from brackets as PHP and Rails do; the query string tool lists parameters as they are without reading brackets.

What happens when a name without brackets repeats?

By default the last value wins, as in PHP, and you can choose to collect the values into an array.

Where do I copy the request body from?

From the Network tab in developer tools: pick the request, open Payload and click view source to get the encoded text.