1# ๐๐ purescript-yoga-json
3**Note**: This is a fork [simple-json](https://github.com/justinwoo/purescript-simple-json) ([MIT Licence](./LICENSE/simple-json.LICENSE)).
7* [migrate from `simple-json`](#migrate-from-purescript-simple-json)
12import Yoga.JSON as JSON
16 JSON.writeJSON { first_name: "Lola", last_name: "Flores" }
19Check out the tests for how to encode/decode increasingly complex types.
21## Migrate from `purescript-simple-json`
23`purescript-yoga-json` is a drop-in replacement for `purescript-simple-json`. Just change the imports from `Simple.JSON` to `Yoga.JSON`.
25## Differences to `simple-json`
27There is an inbuilt codec for `Tuple`s thanks to @ursi
29It includes @justinwoo's codecs for en- and decoding generics inspired by
30[simple-json-generics](https://github.com/justinwoo/purescript-simple-json-generics)
32### ๐ฃ The Variant Codec is different
33If you want to emulate `simple-json`'s format you may use the newtype `TaggedVariant`
36type YourVariantRow = ( a :: Int, b :: String )
37type YourVariant = Variant YourVariantRow
39x = inj (Proxy :: Proxy "a") 5
40-- encoded = writeJSON x
41-- ^ Let's say you had this before
43encoded = writeJSON (TaggedVariant "type" "value" x)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list