# Set default values while decoding JSON

**URL:** <https://discourse.elm-lang.org/t/set-default-values-while-decoding-json/6387>\
**Category:** Learn\
**Created:** [October 9, 2020, 9:06pm UTC](https://discourse.elm-lang.org/t/set-default-values-while-decoding-json/6387 "2020-10-09T21:06:45Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![iwtilma](https://avatars.discourse-cdn.com/v4/letter/i/f0a364/32.png) [@iwtilma](https://discourse.elm-lang.org/u/iwtilma)\
**Post date:** [October 10, 2020, 7:10am UTC](https://discourse.elm-lang.org/t/set-default-values-while-decoding-json/6387/4 "2020-10-10T07:10:21Z")

</div>

Thank you both. Both approaches help me to discover possibilities I would never think of.  
Thanks Atlewee to use the \<| operator as well, showing me how to use it in this situation.  
I think I will go with the Dec.succeed, because it keeps the name of the type in the function.

Any suggestions on a good beginners tutorial on Json decoding? (I read “An Introduction to Elm” of course.)

---

_[View the full topic](https://discourse.elm-lang.org/t/set-default-values-while-decoding-json/6387)._
