Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7524703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:08:14+00:00 2026-05-30T03:08:14+00:00

I am trying to make a POST http.request in Node to an API where

  • 0

I am trying to make a POST http.request in Node to an API where the body is JSON. I convert my object to a JSON string using JSON.stringify, however when I write the string to the request and look at my request it double escapes the data i.e. \ becomes \\\\.

        jsonData = JSON.stringify(myObject)
        // everything is a correct JSON string, with slashes escapped once
        post_req.write(jsonData, 'binary')
        post_req.end()
        console.log post_req // the JSON string was actually sent double escapped

Any tips on how to stop Node automatically double escaping the JSON?
When I take my jsonData and curl or hurl.it it to the server everything works as expected.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:08:15+00:00Added an answer on May 30, 2026 at 3:08 am

    Your data isn’t binary, it’s a string, so just omit the ‘binary’ parameter to post_req.write(jsonData), and it will use utf8, which is what you want. Are you sure the double-escaping is really going over the wire and you aren’t being tricked by trying to console.log the post_req object itself?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a simple HTTP POST request, and I have no idea
I'm trying to make a simple HTTP post a endpoint with ONLY url arguments.
I'm trying to do a HTTP POST with a unicode string (u'\xe4\xf6\xfc') as a
I am trying to make an Http POST to an Apache web server. I
I`m trying to make my Go server send POST request with an array of
I'm trying to make a POST or PUT request to a WCF Service from
What i am trying to do here is make post request to Rest webserivce
I am trying to make HTTP Requests from Delphi using the WinInet functions. So
I'm trying to perform a POST request with node.js, but it always seems to
I am trying to make a cross domain HTTP request to WCF service (that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.