Skip to content

Latest commit

 

History

History

json

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

JSON-as

json-as is an assemblyscript implementation of the JSON serializer.

How to use it

Install the package via yarn add @serial-as/json and add the --transform @serial-as/transform flag to your asc command.

import { stringify, parse } 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 = stringify(object)  

// `decoded` is the Pair = {x:1, y:2}
let decoded: Pair = parse<Pair>(serialized)