# 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:** 2

<div class="post-metadata">

**Author:** ![Atlewee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/atlewee/32/4603_2.png) [@Atlewee](https://discourse.elm-lang.org/u/Atlewee)\
**Post date:** [October 9, 2020, 10:35pm UTC](https://discourse.elm-lang.org/t/set-default-values-while-decoding-json/6387/2 "2020-10-09T22:35:12Z")

</div>

```
D.field "locations" <| D.list <|
  D.map3 Location
    ( D.field "id" D.int )
    ( D.field "name" D.string )
    ( D.succeed True )

```

You use the .succeed decoder. It does not evaluate anything, but gives a sucessful decoding of whatever value you pass to it 🙂

---

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