Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gmlewis/json-to-moonbit
Translates JSON into MoonBit code in your browser instantly.
https://github.com/gmlewis/json-to-moonbit
code json moonbit
Last synced: 26 days ago
JSON representation
Translates JSON into MoonBit code in your browser instantly.
- Host: GitHub
- URL: https://github.com/gmlewis/json-to-moonbit
- Owner: gmlewis
- License: mit
- Created: 2024-08-20T19:47:44.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-08-25T18:48:46.000Z (2 months ago)
- Last Synced: 2024-08-25T23:09:22.618Z (2 months ago)
- Topics: code, json, moonbit
- Language: JavaScript
- Homepage: https://gmlewis.github.io/json-to-moonbit/
- Size: 222 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gmlewis/json-to-moonbit
Translates JSON into MoonBit code. [Check it out!](http://gmlewis.github.io/json-to-moonbit)
This is based on Matt Holt's [json-to-go](http://mholt.github.io/json-to-go).
Things to note:
- The script sometimes has to make some assumptions, so give the output a once-over.
- In an array of objects, it is assumed that the first object is representative of the rest of them.
- The output is indented, but not formatted. Use `moon fmt`!Contributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.
## Usage
- Read JSON file:
```sh
node json-to-moonbit.js sample.json
# or
bun json-to-moonbit.js sample.json
```- Read JSON file from stdin:
```sh
node json-to-moonbit.js < sample.json
cat sample.json | node json-to-moonbit.js
# or
bun json-to-moonbit.js < sample.json
cat sample.json | bun json-to-moonbit.js
```## Status
The code has been updated to support compiler:
```bash
$ moon version --all
moon 0.1.20240920 (13f54ef 2024-09-20) ~/.moon/bin/moon
moonc v0.1.20240920+a1bf2bf0d ~/.moon/bin/moonc
moonrun 0.1.20240920 (13f54ef 2024-09-20) ~/.moon/bin/moonrun
```## Credits
JSON-to-Go is brought to you by Matt Holt ([mholt6](https://twitter.com/mholt6)).
JSON-to-MoonBit is brought to you by Glenn Lewis.
diff is Copyright (c) 2009-2015, Kevin Decker
All rights reserved.
and is used for testing. It is from: https://github.com/kpdecker/jsdiff/
with license: https://github.com/kpdecker/jsdiff/blob/master/LICENSE