aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2022-01-01 16:25:07 +0000
committerLouis Pilfold <louis@lpil.uk>2022-01-01 16:25:07 +0000
commit1889ac98f4979888568790e7bb0e9714da4e7439 (patch)
tree797cc5a04e7543e2af5e3f42501706964067d731
parente1262aef6754a2b4aefc3aeb99ce0f9857d689a4 (diff)
downloadgleam_json-1889ac98f4979888568790e7bb0e9714da4e7439.tar.gz
gleam_json-1889ac98f4979888568790e7bb0e9714da4e7439.zip
Update example
-rw-r--r--README.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/README.md b/README.md
index 0fc8f04..eb36512 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ pub fn cat_to_json(cat: Cat) -> String {
#("name", string(cat.name)),
#("lives", int(9),
#("flaws", null()),
- #("nicknames", list([string("Kitty"), string("Sweetie")])),
+ #("nicknames", array(["Kitty", "Sweetie"], of: string)),
])
|> json.to_string
}
@@ -28,12 +28,12 @@ JSON is decoded into a `Dynamic` value which can be decoded using the
```rust
import myapp.{Cat}
import gleam/json
-import gleam/dynamic.{DecodeError}
+import gleam/dynamic
import gleam/result
pub type MyError {
- InvalidJson
- InvalidFormat(DecodeError)
+ InvalidJson(json.DecodeError)
+ InvalidFormat(dynamic.DecodeError)
}
pub fn cat_from_json(json: String) -> Result<Cat, MyError> {