Featured post
- Get link
- X
- Other Apps
`bigint` cannot be serialized as JSON. Please only return JSON serializable data types
Dear friends, In this article,i am discussing the below points
- What is `bigint` cannot be serialized as JSON. Please only return JSON serializable data types error
- How to fix error using superjson and babel-plugin-superjson-next
What is `bigint` cannot be serialized as JSON. Please only return JSON serializable data types error
When i was working in a next js project, i faced an error while dealing Bigint datatype.I tried a lots of methods.But i couldn't find a solution.I got the below error always
error - Error: Error serializing `.users[0].deactivated` returned from `getServerSideProps` in "/users".
Reason: `bigint` cannot be serialized as JSON. Please only return JSON serializable data types.
How to fix error using superjson and babel-plugin-superjson-next
Finally i decided to use superjson and babel-plugin-superjson-next to fix the error.By executing below command,i installed superjson and babel-plugin-superjson-next
npm i babel-plugin-superjson-next
npm i superjson
then i created a .babelrc file as shown below
{
"presets": ["next/babel"],
"plugins": ["superjson-next"]
}
By executing npm i babel-plugin-superjson-next and npm i superjson and creating .babelrc file,i could fix `bigint` cannot be serialized as JSON. Please only return JSON serializable data types error from my next js project
Later i excuted
npm run build
npm run dev
My next js project worked without any error related to JSON serializable data types
Popular Posts
How to Check React Version Installed in Your System by Checking PACKAGE.JSON File and Executing Command from COMMAND PROMPT
- Get link
- X
- Other Apps
Execution failed for task ':react-native-reanimated:externalNativeBuildDebug' solved
- Get link
- X
- Other Apps
Error: Invalid `prisma.$executeRaw()` invocation: fixed using log: ["query"] option
- Get link
- X
- Other Apps
ERROR Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined
- Get link
- X
- Other Apps
app keeps stopping error solved in android studio emulator using logcat in react native project
- Get link
- X
- Other Apps