How to make a post request with JSON data in application/x-www-form-urlencoded
See original GitHub issuelet data = {
a: "some data",
b: 33,
c: [
{
name: "XYZ",
other: true
},
{
name: "ABC",
other: true
}
]
d: {
something: true
}
}
How to make a POST request with above JSON data, as content-type application/x-www-form-urlencoded using fetch api?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:16
- Comments:21 (4 by maintainers)
Top Results From Across the Web
How do I POST a x-www-form-urlencoded request using Fetch?
You can use FormData and URLSearchParams to post as application/x-www-form-urlencoded with the example below: If you have a form:
Read more >Request body encoding: JSON? x-www-form-urlencoded?
My app was using application/json to make requests to my API but I found a downside to it. The preflighted OPTIONS request is...
Read more >Content Type : x-www-form-urlencoded, form-data and json
Basically there are three ways to send the HTML data to the server. “Content Type : x-www-form-urlencoded, form-data and json” is published by...
Read more >How to post JSON data using Curl? - ReqBin
The JSON content type is set using the -H "Content-Type: application/json" command line parameter. JSON data is passed as a string.
Read more >Add a Request Body to a POST Request | API Connector
A content-type header describes the object's format, so the server knows how to parse it. The default content type will be application/x-www-form-urlencoded.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

That makes sense.
Too bad we need yet another polyfill for that to work…
And that only works for flat objects…
And than again, when the data is that simple, a manual conversion isn’t that hard as well.
Thanks for the quick reply and the insight!
@dgraham using
results in this formData why I try it…