Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aviate-labs/json.mo

JSON for Motoko
https://github.com/aviate-labs/json.mo

Last synced: 3 months ago
JSON representation

JSON for Motoko

Awesome Lists containing this project

README

        

# JSON

[JSON](https://www.json.org/)

## Example

```motoko
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"}
```