-
Notifications
You must be signed in to change notification settings - Fork 27
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
Docs are outdated. How to call JSON.stringify()
?
#320
Comments
I'd use |
@willemneal Thanks. I also had found https://www.npmjs.com/package/json-as (which I guess I will use) but felt inclined to rely on a NEAR repo instead (this one). |
So this entire module can't be used for |
See the link above serial-as/json: import * as JSON from '@serial-as/json'
@serializable
class Pair{
x: i32 = 0,
y: i32 = 0
}
let pair: Pair = {x:1, y:2}
// `serialized` is the string "{"x":1,"y":2}"
let serialized: string = JSON.stringify(object) |
Thanks! So there are 3 npm modules for JSON support in assemblyscript (rather than being built-in) https://www.npmjs.com/package/assemblyscript-json What a mess :( |
The |
Thanks again! Saw that |
@mariusa, |
I'm looking for a replacement of
JSON.stringify()
that I can call in my NEAR AssemblyScript contract.I found this repo.
1edab43 commit message "Made JSON.stringify comptible with javascript JSON" (sic) was encouraging.
But
assemblyscript-json/assembly/JSON.ts
Line 85 in 1edab43
stringify()
, from what I can tell.And even
encoder.stringify()
mentioned at https://github.com/near/assemblyscript-json/blob/1edab439e33acd787671618d33c1ec4250f523c9/README.md#encoding-json doesn't seem to be available.What am I misunderstanding? Thanks!
The text was updated successfully, but these errors were encountered: