diff options
-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 |