Smart Deals - promotions, discount codes and sales

API Payload Formatter

Fast, accurate, and free online API Payload Formatter tool that runs directly in your browser.

Secure (SSL)
Client-Side Processing
100% Free
Instructions
  • 1
    Enter data
    Enter content, paste text or load a file from disk.
  • 2
    Click the button
    The tool will immediately process your data in the browser.
  • 3
    Get the result
    Copy the finished text or save the file to your device.
function runTool() {
  return "Result ready in 0.1s";
}
262 characters
pretty_json
{
    "event": "user.created",
    "meta": {
        "ip": "203.0.113.10",
        "source": "web"
    },
    "user": {
        "email": "[email protected]",
        "id": 12345,
        "profile": {
            "firstName": "Alice",
            "lastName": "Nowak",
            "locale": "pl-PL"
        }
    }
}
Size: 314 chars Klucze: 11 Type: JSON

Rate this tool:

Related tools

Other tools you may find useful

API payload formatter – JSON, XML, YAML with syntax coloring

Working with the API requires constant formatting and validation of payloads: unstructured JSON from the response, compressed XML from the webservice, nested YAML from the configuration. The tool formats with syntax coloring, detects errors and minifies for production.

JSON API formatter payload validator JSON XML YAML formatter API payload formatter

Supported formats and features

JSON: 2/4 space or tab indented formatting, key sorting (optional), minification, RFC 7159 validation. XML: pretty-print indented, well-formedness validation, namespace-aware. YAML: dimpled formatting, conversion to/from JSON. GraphQL: formatting queries and mutations.

Formatting vs minification

Pretty-print (readable): indents, new lines, spaces after colons. Size ~2-4× larger than minified. Minification: removing unnecessary whitespace. JSON: {"key":"val"} instead of { "key": "val" }. Usage: pretty-print for debugging and documentation; minified for production (less transfer).

Error detection and validation

JSON: "unexpected token" (no quotes, trailing commas, comments). XML: "mismatched tag" (unclosed element), "invalid character" (& no entity). YAML: indentation errors, tab chars, no space after colon. The tool indicates the line and column number of the error.

Diff and payload comparison

Diff mode: compare two JSON/XML side-by-side (coloring added/removed/changed keys). Useful: comparison of API v1 and v2 responses, verification that the deployment has not changed the structure. JSON Patch (RFC 6902): JSON changelog.

Frequently asked questions

How to generate valid JSON payload?

Keys in double quotes (not single quotes). No trailing comma after the last element. null/true/false (not NULL/True). Strings with escape: \" (quote), \n (newline), \\ (backslash). Encoding: UTF-8. There are no comments in JSON (use JSONC or remove before sending).

What is application/json vs text/plain?

Content-Type: application/json tells the API that the body is JSON. Without this header: the server may reject or misparse. For sending: -H "Content-Type: application/json" in cURL. Accept: application/json: tells the server that the client expects JSON in the response.

How to debug invalid payload XML?

Check 1) XML declaration (xml version="1.0" encoding="UTF-8"?). 2) Root element (exactly one). 3) Closed tags (contentor). 4) Special characters converted to entities: & → & < → < > → > " → ". 5) Namespace declarations (xmlns="...").

What is GraphQL payload and how to format it?

GraphQL query: { user(id: 1) { name, email, posts { title } } }. Mutation: mutation { createUser(name: "John") { id } }. Variables: {"id": 1}. Endpoint: POST /graphql with body: {"query":"...","variables":{...}}. The tool formats with syntax highlighting and basic validation.

How to use the tool with Postman/Insomnia?

Copy the body request or response from Postman. Paste into tool. Click "Format". Copy the formatted result back to Postman. Alternative: Postman has a built-in "Bautify" (Ctrl+B) for JSON, but not for XML. The tool supports all formats.

Related tools: JSON validator, JSON to CSV converter and cURL to Fetch API converter.

Install Webp.pl Have the tools in your own pocket!