Actually I don't need:

type alias Notes =
    { dailyNotes : List DailyNotes
    }


Am Montag, 26. Dezember 2016 21:31:45 UTC+1 schrieb Sekib Omazic:
>
> Hi all,
>
> I got stuck trying to decode a list of JSON objects I get from server:
>
> -- JSON response from server
>
> [
>   {"day_entry": {"id":1234,"notes":"Map Json "} },
>   {"day_entry": {"id":5678,"notes":"Learn Elm"} }
> ]
>
> -- types
>
> type alias Notes =
>     { dailyNotes : List DailyNotes
>     }
>
>
> type alias DailyNotes =
>     { id : Int
>     , notes : String
>     }
>
>
> -- my decoders 
>
> decodeNotes : Decoder Notes
> decodeNotes =
>     map Notes (field "day_entry" (list decodeDailyNotes))
>
>
> decodeDailyNotes : Decoder DailyNotes
> decodeDailyNotes =
>     map2 DailyNotes (field "id" int) (field "notes" string)
>
>
> It fails with Err BadPayload. 
>
> Any help is appreciated.
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to