title: How to post nested JSON object with Axios?
body: <p>I'm building a React app that interacts with a Wordpress installation through the Wordpress REST API. Right now I'm trying to create a form where a user can update their personal information: when the form is submitted, I invoke the following action, which receives the form data and sends a POST request: </p>
  
  <pre><code>export const updateUserInfo = ( userInfo ) =&gt; async ( dispatch, getState, api ) =&gt; {
  
      // userInfo looks like this:
      // {
      //     "firstname": "John",
      //     "lastname": "Doe"
      // }
  
      const userID = getState().currentUser.ID.data; 
  
      const postUserInfo = {
          "personal_info": userInfo
      }
  
      const requestAuth = {
          'headers': {
              'Content-type': 'application/json', 
              'Authorization': 'Bearer ' + cookies.get( 'userToken' )
          }
      }
  
      await api.post( '/wp-json/wp/v2/users/' + userID, postUserInfo, requestAuth ); 
  
  }
  </code></pre>
  
  <p>The POST request is successful (200 code), and the payload looks correct as well: </p>
  
  <pre><code>{
      "personal_info": {
          "firstname": "John", 
          "lastname": "Doe", 
      }
  }
  </code></pre>
  
  <p>but the sad truth is the user's info does not get updated, so the values "John" and "Doe" are never really posted...   </p>
  
  <p>I have similar requests working when the received <code>userInfo</code> is not an object but a simple value, which is what leads me to think the problem is with the nested object. </p>