import JSON "mo:json/JSON";
import Debug "mo:base/Debug";
let obj : JSON.JSON = #Object([]);
Debug.print(JSON.show(obj));
// {}
Debug.print(JSON.show(#Object([("username", #String("di-wu"))])));
// {"username": "di-wu"}
Debug.print(JSON.show(#Object([
("name", #Object([
("firstName", #String("quint"))
])),
("username", #String("di-wu"))
])));
// {"name": {"firstName": "quint"}, "username": "di-wu"}
aviate-labs / json.mo Goto Github PK
View Code? Open in Web Editor NEWJSON for Motoko
License: Apache License 2.0