We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have the following Type called Message with the following code
Message
module Types.Message exposing (Message, decode, decodeList) import Json.Decode as Decode exposing (Decoder, Error, list) import Json.Decode.Pipeline exposing (required) type alias Message = { username : String , content : String } decode : Decoder Message decode = Decode.succeed Message |> required "username" Decode.string |> required "content" Decode.string decodeList : Decoder (List Message) decodeList = list decode
I try to decode using something like this
decodeMessage : Decode.Value -> Result Error (List Message) decodeMessage messageJson = Decode.decodeValue Message.decodeList messageJson
I found out that it works perfectly in REPL
> decodeString decode "{\"username\": \"mantap\", \"content\": \"lalui\"}" Ok { content = "lalui", username = "mantap" } : Result Error Message
However, when I run the Webpack build using the elm-webpack-loader in Electron environment I found the following error
elm-webpack-loader
Problem with the value at json[0]: "{\"content\": \"Budi\", \"username\": \"UHU\"}" Expecting an OBJECT with a field named `content`
Any idea why?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have the following Type called
Message
with the following codeI try to decode using something like this
I found out that it works perfectly in REPL
However, when I run the Webpack build using the
elm-webpack-loader
in Electron environment I found the following errorAny idea why?
The text was updated successfully, but these errors were encountered: