holochain / hdk-assemblyscript

The Holochain Developer Kit for Assemblyscript
41 stars 2 forks source link

Add a JSON.stringify function and class decorator that allows it to be called with custom classes #16

Closed willemolding closed 5 years ago

willemolding commented 5 years ago

Usage should be something like:

@serializable
class A {
  x: string
  y: i32
}
const a: A = {x: "hi", y: 30}
JSON.stringify(a); // {"x":"hi","y":30}

It should also be possible to call stringify on arrays and primitive types.

willemolding commented 5 years ago

Already implemented in https://github.com/willemolding/jsmn-as. I will migrate it to the HDK