Hi guys,
So I was trying to decode a field named date inside JSON as String but
without success. And the result is quite confusing.
Could anyone shed some light on me?
JSON:
[{"author":{"type":"full","displayName":"fxmy","url":"https://github.com/fxmy","picture":"https://avatars.githubusercontent.com/u/3283415?v=3&s=73"},"content":"another
test","date":"2017-01-26T03:43:57.190Z"}]
Json.Encode.Value that comes through port ( via Debug.log) :
value: { 0 = { author = { type = "full", displayName = "fxmy", url =
"https://github.com/fxmy", picture =
"https://avatars.githubusercontent.com/u/3283415?v=3&s=73" }, content =
"another test", date = <Thu Jan 26 2017 11:43:57 GMT+0800 (CST)> } }
When trying to decode date field as String I got this,
Result after calling Json.Decode.decodeValue ( via Debug.log) :
Err "Expecting a String at _[0].date but instead got:
\"2017-01-26T03:43:57.190Z\""
What am I doing wrong?
Cheers.
--
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.