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

223
Views
Why JSON parse return undefined?

This is the string goes in:

"{"eventId":"program-1","eventTimesSelected":{"243759548768171":"2021-11-30T23:00:00Z"}}"

And it fails basically, why?

const startPaymentIn2 = localStorage.getItem("startPaymentIn");
let startPaymentIn3 = JSON.parse(startPaymentIn2);

Maybe only debugger plan fun with me?

enter image description here

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

0

It's the quotations, try this instead

Javascript gets confused the three first characters, "{" is a solitary string.

You can read more about strings here.

let JSONString = `{"eventId":"program-1","eventTimesSelected":{"243759548768171":"2021-11-30T23:00:00Z"}}`

let jsonObject = JSON.parse(JSONString)

console.log(jsonObject)

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!