-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object
("[object Decimal]") cannot be serialized as JSON
#9170
Comments
The Here it is documented on how to create one: https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields#working-with-decimal Do we have better documentation on how to consume them via Client @matthewmueller? |
This is not a Prisma issue technically. People generally use the superjson(https://github.com/blitz-js/superjson#using-with-nextjs) here to solve this serialization issue but for Decimals, they also don't have a mapping(flightcontrolhq/superjson#152). |
Similar issue from examples with a workaround: prisma/prisma-examples#3047 |
Does that makes sense to include a serialization tool into Prisma? |
Any update? |
My meager attempt at a generic conversion
|
Bug description
Hello. I have a model
City
in my prisma schema with coordinates (latitude and longitude fields):But when I'm trying to acces this data using Prisma I get the following error:
This is pretty strange because I thought Prisma would convert DECIMAL type to JavaScript's float automatically.
How to reproduce
Expected behavior
No response
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: