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

259
Views
SyntaxError: Unexpected token 2 in JSON at position 0

I was Sending data from CLient Site => server => Data Base. But The error happens on the serverside's terminal.

syntaxError: Unexpected token 2 in JSON at position 0
at JSON.parse (<anonymous>)
at createStrictSyntaxError (C:\Users\ANUPAM\Desktop\assigment\assigment-11\book-hut-server\node_modules\body-parser\lib\types\json.js:160:10)
at parse (C:\Users\ANUPAM\Desktop\assigment\assigment-11\book-hut-server\node_modules\body-parser\lib\types\json.js:83:1S)
at C:\Users\ANUPAM\Desktop\assigment\assigment-11\book-hut-server\node_modules\body-parser\lib\read.js:128:18
at AsyncResource.runInAsyncScope (node:async_hooks:199:9)
at invokeCallback (C:\Users\ANUPAM\Desktop\assigment\assigment-11\book-hut-server\node_modules\raw-body\index.js:231:16)
at done (C:\Users\ANUPAM\Desktop\assigment\assigment-11\book-hut-server\node_modules\raw-body\index.js:220:7)
at IncomingMessage.onEnd (C:\Users\ANUPAM\Desktop\assigment\assigment-11\book-hut-server\node_modules\raw-body\index.js:280:7)
at IncomingMessage.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)

This is my client-side Code.

fetch(putUrl, {
            method: "PUT",
            headers: {
                'content-type': 'application/json'
            },
            body: JSON.stringify(newQuantity)
        })

This is server-side code

app.put('/update/:id', async (req, res) => {
            res.send('Go')
        })
about 4 years ago · Juan Pablo Isaza
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!