title: Elm: Decode a JSON array with a single element into a string
body: <p>had a look for something like this, but can't find the exact issue.</p>
  
  <p>I have a JSON back from server side validation that looks like:</p>
  
  <pre><code>{ 
    "field": ["field-name"], 
    "messages":["message","message"]
  }
  </code></pre>
  
  <p>What I would like to do is decode it into an elm record like</p>
  
  <pre><code>{ field: String, messages: List String }
  </code></pre>
  
  <p>However, I'm having trouble with the err, field field. I'm having trouble turning a single element JSON array into just a string of that element.</p>
  
  <p>Is it even possible with Decode, or am I better of Decoding it into a List and then just grabbing the head from the list.</p>
  
  <p>This is what I have for the decode:</p>
  
  <pre><code>valErrorDecoder : Decode.Decoder ValError
  valErrorDecoder =
  decode ValError
      |&gt; required "field" (Decode.list Decode.string)
      |&gt; required "messages" (Decode.list Decode.string)
  </code></pre>
  
  <p>Thanks for any help!</p>