-
Notifications
You must be signed in to change notification settings - Fork 44
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
add helpers to make BigInt compatible with JSON.stringify #402
Comments
const test= Proposal.fromPartial({ I have to say it takes one more step... but this's currently the best we can do... |
I believe generating like this can solve the problem, and then we can make all functions that returns the interface(Proposal) using this creation: function createBaseProposal(): Proposal { I've tested and it's working: const test= Proposal.fromPartial({ // it will call toJSON inside and work console.log(testString); let testJson = JSON.parse(testString) // and then using fromJSON to get original Proposal type with bigint inside Hope this make sense. If you like the solution, I can make the change. |
Lgtm! We can add toJSON to createBase function that have bigInt fields and it should be good! |
@Zetazzz can you review the PR above |
let ppl define they own way of parsing object with bigInt |
Currently we can have the option to encode/decode int64 as bigInt instead of Long. However, we're having a problem with display the response because
JSON.stringify
by default doesn't have the option to parse bigInt, as described in this issue. We should add helper to bigInt so that stringify can work with bigInt.The text was updated successfully, but these errors were encountered: