From e1262aef6754a2b4aefc3aeb99ce0f9857d689a4 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sat, 1 Jan 2022 16:24:03 +0000 Subject: I wish we had syntax highlighting --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 415a654..0fc8f04 100644 --- a/README.md +++ b/README.md @@ -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 -- cgit v1.2.3