`object` (“[object Date]”) cannot be serialized as JSON

Error I was using Next.js 13, TypeScript, and MongoDB with Mongoose. I got the following error: Server Error Error: Error serializing .gasLog[1].createdAt returned from getServerSideProps in "/table". Reason: object ("[object Date]") cannot be serialized as JSON. Please only return JSON serializable data types. This error happened while generating the page. Any console logs will be … Continue reading `object` (“[object Date]”) cannot be serialized as JSON

Uncaught SyntaxError: Unexpected non-whitespace character after JSON at position X at JSON.parse

In my node server, I was getting undefined when trying to access a property on an object such as dog.name. It turns out the error I was getting before that was Uncaught SyntaxError: Unexpected non-whitespace character after JSON at position X at JSON.parse. I decided to find the original input's typeof. console.log(typeof input); // 'string' … Continue reading Uncaught SyntaxError: Unexpected non-whitespace character after JSON at position X at JSON.parse