module Participant exposing (Participant, decoder) import Json.Decode exposing (Decoder, field, map2, string) import Json.Encode as Enc exposing (object) type alias Participant = { id : String , name : String } decoder : Decoder Participant decoder = map2 Participant (field "id" string) (field "name" string) encode : Participant -> String encode participant = object [ ( "id", Enc.string participant.id ) , ( "name", Enc.string participant.name ) ] |> Enc.encode 0