Comment

Comment by k3n

Can you provide some more context?

    > JSON.stringify(1)
    "1"
Stored without a decimal for free, seems like it'd be up to the receiver to interpret it correctly.

What if you receive it in JS?

    JSON.parse(JSON.stringify(1))
    > 1
Ok, so it parses an int for free too... thus my confusion.

Regardless, you can still override anything it does considering the second argument to both `JSON.parse()` and `JSON.stringify()` allows you to provide your own function for handling the logic as you see fit.

parent k3n 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton