diff options
author | Louis Pilfold <louis@lpil.uk> | 2022-01-01 16:25:07 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-01-01 16:25:07 +0000 |
commit | 1889ac98f4979888568790e7bb0e9714da4e7439 (patch) | |
tree | 797cc5a04e7543e2af5e3f42501706964067d731 | |
parent | e1262aef6754a2b4aefc3aeb99ce0f9857d689a4 (diff) | |
download | gleam_json-1889ac98f4979888568790e7bb0e9714da4e7439.tar.gz gleam_json-1889ac98f4979888568790e7bb0e9714da4e7439.zip |
Update example
-rw-r--r-- | README.md | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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> { |