Cannot stringify arbitrary non-POJOs #7259
-
When adding a +page.server.ts file and filling it with the contents
SvelteKit throws the error
Is this a regression in SvelteKit caused by devalue bumping to 4.0.0? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
This is expected. You only return POJOs (plain-old-javascript-objects) from export async function load({ params }) {
return { hello: 'world', count: 2 }
} The |
Beta Was this translation helpful? Give feedback.
-
Just a quick note on this. I'm new to Svelte coming from React. |
Beta Was this translation helpful? Give feedback.
-
@geoffrich Yes, I realise that now. I was trying to be smart and saw that the example used "fail" and in my enthusiasm thought I would use "json" to return the successful result. Now that I understand that "json" forms a Response object I can see that is not what I want to do, but initially I saw "fail", "json" etc. as a set of helpers and naively if I could use one I could use them all. Thanks for your clarification, hopefully, this might help someone else. |
Beta Was this translation helpful? Give feedback.
-
Hello guys, I know I'm late for the party. I just ran into this problem myself when using Prisma.Decimal field type in the database. I found that superjson can Cheers |
Beta Was this translation helpful? Give feedback.
-
You can now use the transport hook to define custom encoders and decoders. |
Beta Was this translation helpful? Give feedback.
You can now use the transport hook to define custom encoders and decoders.