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
original
Json.Decode.Pipeline
Thanks for a great service!
This JSON gives some funny results.
{"cpus":4 ,"port":8080 ,"localprefix":"localfolder" ,"name":"myjob" ,"hash":"edebf0f9966282ea565cf6e3b0cf1eff" ,"source-folder":"myfolder" ,"load-timestamp":1496932552590 }
Generated Elm code (as of 2017-06-09 from http://eeue56.github.io/json-to-elm/, toplevel alias "Job"):
import Json.Encode import Json.Decode exposing (field) type alias Job = { cpus : Int , port : Int , localprefix : String , name : String , hash : String , sourceFolder : String , loadTimestamp : Int } decodeJob : Json.Decode.Decoder Job decodeJob = Json.Decode.Pipeline.decode Job |> Json.Decode.Pipeline.required "cpus" (Json.Decode.int) |> Json.Decode.Pipeline.required "port" (Json.Decode.int) |> Json.Decode.Pipeline.required "localprefix" (Json.Decode.string) |> Json.Decode.Pipeline.required "name" (Json.Decode.string) |> Json.Decode.Pipeline.required "hash" (Json.Decode.string) |> Json.Decode.Pipeline.required "sourceFolder" (Json.Decode.string) |> Json.Decode.Pipeline.required "loadTimestamp" (Json.Decode.int) encodeJob : Job -> Json.Encode.Value encodeJob record = Json.Encode.object [ ("cpus", Json.Encode.int <| record.cpus) , ("port", Json.Encode.int <| record.port) , ("localprefix", Json.Encode.string <| record.localprefix) , ("name", Json.Encode.string <| record.name) , ("hash", Json.Encode.string <| record.hash) , ("sourceFolder", Json.Encode.string <| record.sourceFolder) , ("loadTimestamp", Json.Encode.int <| record.loadTimestamp) ]
After adding import Json.Decode.Pipeline to the top of the file and running elm package install NoRedInk/elm-decode-pipeline, code compiles.
import Json.Decode.Pipeline
elm package install NoRedInk/elm-decode-pipeline
The text was updated successfully, but these errors were encountered:
This was a problem for me too. It should not use pipeline when the original setting is active!
Sorry, something went wrong.
No branches or pull requests
Thanks for a great service!
This JSON gives some funny results.
Test case
Generated Elm code (as of 2017-06-09 from http://eeue56.github.io/json-to-elm/, toplevel alias "Job"):
Unexpected things
Json.Decode.Pipeline
without importing itWalkaround
After adding
import Json.Decode.Pipeline
to the top of the file and runningelm package install NoRedInk/elm-decode-pipeline
, code compiles.The text was updated successfully, but these errors were encountered: