Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/aviate-labs/json.mo
- Owner: aviate-labs
- License: apache-2.0
- Created: 2021-08-23T14:23:38.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-09T18:20:36.000Z (9 months ago)
- Last Synced: 2024-04-19T01:33:33.831Z (7 months ago)
- Language: Motoko
- Homepage:
- Size: 17.6 KB
- Stars: 19
- Watchers: 3
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-motoko - json package - JSON for Motoko. (Libraries / Encoding)
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"}
```