By default axios uses Json for posting data so you don't need to stringify your data. The problem could be that you're doing that. Could you try doing the post without it and check if it works? Also you don't need the curly braces to wrap your data unless that's the format of the object in your server. Otherwise could you give me information about how the body of the request looks like so I have more context? You can check that in chrome dev tools using the network tab

Answer from Santiago Benitez on Stack Overflow
🌐
Axios
axios-http.com › docs › post_example
POST Requests | Axios Docs
function getUserAccount() { return axios.get('/user/12345'); } function getUserPermissions() { return axios.get('/user/12345/permissions'); } const [acct, perm] = await Promise.all([getUserAccount(), getUserPermissions()]); // OR Promise.all([getUserAccount(), getUserPermissions()]) .then(function ([acct, perm]) { // ... }); Post an HTML form as JSON ·
🌐
Mastering JS
masteringjs.io › tutorials › axios › post-json
POST JSON with Axios - Mastering JS
June 12, 2020 - If you pass a JavaScript object as the 2nd parameter to the axios.post() function, Axios will automatically serialize the object to JSON for you.
Discussions

how can i axios post json data same as jq post json data?
i want to post json string to server,i use jq post will sccuess, use axiso post will error, i look this headers content-type and data is differ. More on github.com
🌐 github.com
1
March 28, 2018
Axios posts as JSON object, how to change
1 react axios post generates json in array format. More on stackoverflow.com
🌐 stackoverflow.com
November 12, 2019
Post a number as a JSON
Hello, When posting an object or array with axios, axios automatically sets the request content type to 'application/json', which is the common use case for APIs nowadays. According to the ... More on github.com
🌐 github.com
7
December 19, 2019
JSON Post with arrays
When sending a POST with data that includes an array, it's being convert to an object. Eg: axios.post('/endpoint', {names: ['a', 'b', 'c']}, { headers: {'Content-Type': 'application/json'} }) More on github.com
🌐 github.com
1
March 10, 2020
🌐
GitHub
github.com › axios › axios
GitHub - axios/axios: Promise based HTTP client for the browser and node.js · GitHub
9 hours ago - Automatic JSON Handling: Automatically serializes and parses JSON data. Form Serialization: 🆕 Automatically serializes data objects to multipart/form-data or x-www-form-urlencoded formats.
Starred by 109K users
Forked by 11.6K users
Languages   JavaScript 86.1% | TypeScript 11.9% | HTML 2.0%
🌐
LogRocket
blog.logrocket.com › home › axios in javascript: how to make get, post, put, and delete requests
Axios in JavaScript: How to make GET, POST, PUT, and DELETE requests - LogRocket Blog
April 9, 2025 - This code instructs Axios to send a POST request to /login with an object of key-value pairs as its data. Axios will automatically convert the data to JSON and send it as the request body.
🌐
Stack Abuse
stackabuse.com › sending-post-json-requests-with-axios
Sending POST JSON Requests With Axios
June 21, 2022 - For example, if we have a registration ... JSON request. We use the axios.post() method to send a POST request with Axios, which takes two major parameters - the URL of the endpoint (url), and the object representing data we want to post (data):...
🌐
LogRocket
blog.logrocket.com › home › axios post requests: handling errors, authentication, and best practices
Axios POST requests: Handling errors, authentication, and best practices - LogRocket Blog
May 9, 2025 - Similarly, Axios also de-serializes a JSON response out of the box. With the native Fetch API, you need to parse it using JSON.parse. Unlike the built-in Fetch API, Axios provides convenient methods for each of the HTTP request methods.
Find elsewhere
🌐
Mastering JS
masteringjs.io › tutorials › axios › post
POST Requests with Axios - Mastering JS
If the 2nd parameter is an object, Axios also sets the content-type header to application/json, so most web frameworks, like Express, will be able to automatically convert the request body into a JavaScript object for you. const res = await ...
🌐
Axios
axios-http.com › docs › intro
Getting Started | Axios Docs
Posting HTML forms as JSON · Automatic JSON data handling in response · Progress capturing for browsers and node.js with extra info (speed rate, remaining time) Setting bandwidth limits for node.js · Compatible with spec-compliant FormData and Blob (including node.js) Client side support for protecting against XSRF · Using npm: $ npm install axios ·
🌐
ZetCode
zetcode.com › javascript › axios
Axios Tutorial - Simplifying HTTP Requests
A POST request is created with post method. Axios automatically serializes JavaScript objects to JSON when passed to the post function as the second parameter; we do not need to serialize POST bodies to JSON.
🌐
GitHub
github.com › axios › axios › issues › 1440
how can i axios post json data same as jq post json data? · Issue #1440 · axios/axios
March 28, 2018 - // test data let sendData = [{"what":"login","when":1522142738820,"who":"drama-material","platform":"web","context":{"browser":{"tz":"+8","lang":"zh-cn","width":1920,"height":1080,"brover":"chrome/65.0.3325.181","os":3,"osver":"Win10","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36","ref":"http://localhost:8080/"},"data":{"rtime":0,"new":0,"lway":0,"c":"drama","sc":"drama","extc":"drama","fc":"drama","cip":"120.236.179.45","uid":"","appv":"","time":1522142738554}}}] // jq post $.post('http://192.168.90.251:8764/common/do
Author   yyman001
🌐
RapidAPI
rapidapi.com › guides › axios-different-data-formats
How to use Axios with different data formats?
... To send a POST request with Axios and JSON data, you can use the axios.post() method and pass in the URL of the API endpoint you want to send data to, as well as the JSON data you want to send.
🌐
Mastering JS
masteringjs.io › tutorials › axios › json
How to Use JSON with Axios - Mastering JS
April 21, 2021 - // Axios automatically serializes `{ answer: 42 }` into JSON. const res = await axios.post('https://httpbin.org/post', { answer: 42 }); res.data.data; // '{"answer":42}' res.data.headers['Content-Type']; // 'application/json;charset=utf-8',
🌐
GitHub
github.com › axios › axios › issues › 2613
Post a number as a JSON · Issue #2613 · axios/axios
December 19, 2019 - And according to the official JSON specification's right sidebar, a valid JSON stream can also be a primitive value (null, a boolean, a number or a string). But axios.post(url, 42) will not send the request as content-type='application/json', but as 'application/x-www-form-urlencoded'.
Author   slaout
🌐
Jason Watmore's Blog
jasonwatmore.com › post › 2021 › 06 › 25 › axios-http-post-request-examples
Axios - HTTP POST Request Examples | Jason Watmore's Blog
June 25, 2021 - // Simple POST request with a JSON body using axios const element = document.querySelector('#post-request .article-id'); const article = { title: 'Axios POST Request Example' }; axios.post('https://reqres.in/api/articles', article) .then(response => element.innerHTML = response.data.id); Example ...
🌐
npm
npmjs.com › package › axios
axios - npm
1 week ago - By default, axios serializes JavaScript objects to JSON. To send data in the application/x-www-form-urlencoded format instead, you can use the URLSearchParams API, which is supported in the vast majority of browsers, and Node starting with v10 ...
      » npm install axios
    
Published   Mar 27, 2026
Version   1.14.0
Author   Matt Zabriskie
🌐
GitHub
github.com › axios › axios › issues › 2813
JSON Post with arrays · Issue #2813 · axios/axios
March 10, 2020 - When sending a POST with data that includes an array, it's being convert to an object. Eg: axios.post('/endpoint', {names: ['a', 'b', 'c']}, { headers: {'Content-Type': 'application/json'} })
Author   yamila-fraiman
🌐
Axios
axios-http.com › docs › urlencoded
URL-Encoding Bodies | Axios Docs
By default, axios serializes JavaScript objects to JSON. To send data in the application/x-www-form-urlencoded format instead, you can use one of the following approaches. In a browser, you can use the URLSearchParams API as follows: const params = new URLSearchParams(); params.append('param1', ...
🌐
Reddit
reddit.com › r/reactjs › axios post request help! when i use get request, it works perfectly fine though. essentially, when i make a post request using axios, there is no data that is being passed through. i tried even setting the data param to id: "string", and even that didn't pass through as im getting undefined.
r/reactjs on Reddit: Axios Post Request Help! When I use Get request, it works perfectly fine though. Essentially, when I make a post request using axios, there is no data that is being passed through. I tried even setting the data param to Id: "string", and even that didn't pass through as im getting undefined.
March 18, 2023 -

Front

import React from 'react'
import { useState } from 'react'
import Sidebar from './sidebar/Sidebar'
import Axios from 'axios'
import './gui.css'
const sideBar3Dark = {
height : '100vh',
width : '82.5vw',
backgroundColor : '#161818',
marginLeft: '17.5vw'
}
function HomeGui() {
const [newAboutUs, setVal] = useState("");
const handleSubmit = (e) => {
e.preventDefault();
/*
Axios.get('http://localhost:4000/api/get/aboutUs').then(res => {
console.log(res);
})
*/
Axios.post('http://localhost:4000/api/post', { Id: newAboutUs }).then(res => console.log(res)).catch(err => console.log(err));
  }
return (
<div className='homeGui'>
<form onSubmit={ handleSubmit }>
<input type="text" value = {newAboutUs} onChange={(e) => {setVal(e.target.value)}}/>
<button></button>
</form>
</div>
  )
}
function Gui() {
const [contentStyle, setContentStyle] = useState(sideBar3Dark)
return (
<>
<div className='gui'>
<Sidebar changeStyle={(size) => {setContentStyle(size)}} />
<div className='mainGui' style={ contentStyle }>
<HomeGui/>
</div>
</div>
</>
  )
}
export default Gui

Backend

const express = require('express');
const app = express();
const bodyParser = require("body-parser");
const cors = require('cors');
const fs = require('fs');
app.use(cors());
app.use(bodyParser.urlencoded({ extended: true }));
app.get("/api/get/aboutUs", (req, res) => {
fs.readFile('../client/src/data/aboutUs.json', 'utf-8', (err, jsonString) => {
if (err) {
console.log(err);
} else {
try {
const data = JSON.parse(jsonString);
console.log(data);
res.send(data);
} catch(err) {
console.log(err);
}
}
});
});
app.post("/api/post", (req, res) => {
console.log(req.body.Id);
});
app.listen(4000, () => {
console.log('PORT 4000 connected');
});
Essentially at when I perform console.log(req.body.Id) in app.post(...), it just says undefined in my console, but I do not know why.