title: Reading from a YAML file in Kotlin
body: <p>I'm having a hard time trying to figure out how to read a YAML file in Kotlin.</p>
  <p>In short, the YAML has the following format:</p>
  <pre class="lang-yaml prettyprint-override"><code>aws:
    foo:
      dev:
        id: '1111'
      pro:
        id: '2222'
    bar:
      dev:
        id: '3333'
      pro:
        id: '4444'
  </code></pre>
  <p>I have created these data classes:</p>
  <pre class="lang-kotlin prettyprint-override"><code>data class Account (
          val id: String
  )
  
  data class Owner (
          val accounts: List&lt;Account&gt;
  )
  
  data class Cloud (
          val owners: List&lt;Owner&gt;
  )
  </code></pre>
  <p>And then I try to parse the file with:</p>
  <pre class="lang-kotlin prettyprint-override"><code>val mapper = ObjectMapper().registerModule(KotlinModule())
  val settings: Cloud = mapper.readValue(Path.of(&quot;accounts.yaml&quot;).toFile())
  # also tried this
  val settings: List&lt;Cloud&gt; = mapper.readValue(Path.of(&quot;accounts.yaml&quot;).toFile())
  println(settings)
  </code></pre>
  <p>the <code>println</code> fails with <code>Exception in thread &quot;main&quot; com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'aws': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')</code></p>
  <p>Why?</p>