No Login Data Private Local Save

JSON to Form Data Converter - Online Encode for POST

10
0
0
0

JSON to Form Data Converter

Convert JSON objects to URL-encoded form data strings for POST requests

JSON Input 0 chars
Form Data Output
0 chars

Frequently Asked Questions

JSON to Form Data conversion transforms a JSON object into the application/x-www-form-urlencoded format — the standard encoding used when submitting HTML forms via POST requests. For example, {"name":"John","age":30} becomes name=John&age=30. This encoding is essential for traditional server-side form processing, API calls using Content-Type: application/x-www-form-urlencoded, and URL query string construction. Nested objects use bracket notation like user[name]=John, while arrays can use tags[]=dev or indexed tags[0]=dev notation.

Nested objects are flattened using square bracket notation. For example, {"user":{"name":"John","address":{"city":"NYC"}}} becomes user[name]=John&user[address][city]=NYC. Arrays can be formatted in three ways: brackets (tags[]=a&tags[]=b, PHP-style), indexed (tags[0]=a&tags[1]=b), or repeated keys (tags=a&tags=b). Choose the format that matches your backend framework's expectations — PHP natively supports bracket notation, while some frameworks prefer indexed arrays.

Use form data encoding (application/x-www-form-urlencoded) when: submitting traditional HTML forms, interacting with older APIs that expect form-encoded data, making OAuth token requests, or when the backend uses $_POST (PHP), request.form (Flask), or similar form parsers. Use JSON (application/json) for modern REST APIs, complex nested data structures, or when working with JavaScript frontends. Form data is simpler but less expressive; JSON handles deep nesting and typed data more naturally. This converter bridges the gap when you need to send JSON-structured data to a form-encoded endpoint.

URL encoding (also called percent-encoding) converts special characters into a safe format for transmission. Characters like spaces become %20 or +, ampersands become %26, and equals signs become %3D. Without proper encoding, values containing & or = would corrupt the form data structure. This tool uses encodeURIComponent() for values by default, ensuring all special characters are safely encoded. You can toggle encoding off to see the raw structure, but always encode when sending actual requests.

PHP natively parses bracket notation: user[name] automatically becomes $_POST['user']['name']. Express.js with express.urlencoded({extended: true}) uses the qs library for rich nested parsing. Flask (Python) requires manual parsing or the werkzeug multidict. Spring Boot (Java) can bind indexed arrays but may need @ModelAttribute configuration. Ruby on Rails uses Rack's nested param parsing with bracket notation. Always check your framework's documentation for the expected array and nesting format — this tool's array format selector helps you match your backend's requirements.

No — this tool generates application/x-www-form-urlencoded strings, not multipart/form-data. Multipart encoding is required for file uploads and uses a completely different format with boundary separators. If you need to include files in a request, use FormData objects in JavaScript or proper multipart encoding libraries. This tool is designed for text-only key-value pairs typically sent in standard form submissions, API authentication flows, and URL query strings.

JavaScript fetch: fetch(url, {method:'POST', headers:{'Content-Type':'application/x-www-form-urlencoded'}, body: formDataString}). cURL: curl -X POST -d "key=value&key2=value2" https://api.example.com. PHP: Use the string directly with file_get_contents('php://input') or let the server parse it automatically into $_POST. Python requests: requests.post(url, data=formDataString, headers={'Content-Type':'application/x-www-form-urlencoded'}). The output from this tool is ready to use as the request body.