Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

297
Views
Issue sending over JSON as string from POSTMAN to node server

I have some json that looks like this:

const json = {
   "name": "Peter",
   "age": 21
}

Then I call JSON.stringify(json) which gives me the following:

'{"name":"Peter","age":21}'

I want to send data from the UI to my server. Currently I am using POSTMAN for this.

POST
http:localhost:8888/user
Body -> JSON

{
  "user": { 
     "details": '{"name":"Peter","age":21}',
     "foo": "bar"
   }
}

details here needs to be a string but when I send over the data I get the following error on the server

SyntaxError: Unexpected token } in JSON at position 114

Does anyone have any ideas here?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

JSON does not allow for single quotes, what you are trying to send is invalid. What you need to do is use double quotes and escape the internal quotes for the JSON key/values:

{
  "user": { 
     "details": "{\"name\":\"Peter\",\"age\":21}",
     "foo": "bar"
   }
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!