https://github.com/jaredly/ppx_autoserialize
https://github.com/jaredly/ppx_autoserialize
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/jaredly/ppx_autoserialize
- Owner: jaredly
- Created: 2017-08-22T02:18:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-02T16:48:14.000Z (almost 8 years ago)
- Last Synced: 2025-03-30T20:33:48.918Z (about 1 year ago)
- Language: OCaml
- Size: 180 KB
- Stars: 27
- Watchers: 3
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Autoserialize
What do we want? no-pain jsonifying, devtools integration, and pretty printing
of values for debugging!
What does it look like?
```reason
type myThing = {
something: int,
moreThings: option string,
};
let myValue = {something: 10, moreThings: Some "hello"};
/* ooh magically myThing__to_devtools is available! */
Js.log (myThing__to_devtools myValue);
Js.log (Js.Json.stringify (myThing__to_json myValue));
switch (myThing__from_json (myThing__to_json myValue)) {
| None => Js.log "Failed to deserialize"
| Some roundTripped => Js.log "It worked!"
}
```
## Example screenshots!


## How battled hardened is it?
As much as a wooden horse.
## How well does it work?
As a ppx, it will only run on the code in the current project. If you want to
serialize code that includes types from other libraries, we'll need something
else (I have an idea for that too). Or we could have bucklescript run this ppx
on all of everything, which would probably have prohibitive performance
implications.