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

751
Views
Error: How to serialize data from getStaticProps in Next.js

I am trying to fetch data from an Api but for sorry i've received this Error:

Server Error Error: Error serializing .results returned from getServerSideProps in "/". Reason: undefined cannot be serialized as JSON. Please use null or omit this value.

my code

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

0

The props you're passing contain an object with a key of value undefined. A quick solution would be

return {
 props: {
   results: JSON.parse(JSON.stringify(request.results)); 
 }
}

JSON.stringify will remove those undefined values. You can try it out in your browser console: JSON.stringify({someKey:undefined})

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!