diff options
author | Louis Pilfold <louis@lpil.uk> | 2022-01-01 16:24:03 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-01-01 16:24:03 +0000 |
commit | e1262aef6754a2b4aefc3aeb99ce0f9857d689a4 (patch) | |
tree | 3a4513280168fedcfd2698d89940a4fcbb41ae69 | |
parent | a0d4e6eb54de54bbb33df486374701bbdcd6c3e9 (diff) | |
download | gleam_json-e1262aef6754a2b4aefc3aeb99ce0f9857d689a4.tar.gz gleam_json-e1262aef6754a2b4aefc3aeb99ce0f9857d689a4.zip |
I wish we had syntax highlighting
-rw-r--r-- | README.md | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -5,13 +5,10 @@ Work with JSON in Gleam! ### Encoding ```rust +import myapp.{Cat} import gleam/list import gleam/json.{object, string, list, int, null} -pub type Cat { - Cat(name: String) -} - pub fn cat_to_json(cat: Cat) -> String { object([ #("name", string(cat.name)), @@ -29,6 +26,7 @@ JSON is decoded into a `Dynamic` value which can be decoded using the `gleam/dynamic` module from the Gleam standard library. ```rust +import myapp.{Cat} import gleam/json import gleam/dynamic.{DecodeError} import gleam/result |