title: JSON Serialization / Deserialization Kotlin Android Jetpack Compose Table
body: <p>I'm in the process of creating a table section in Jetpack Compose that deserializes the data from a JSON.</p>
  <p>At this point, I'm simply trying to display the data (the table formatting and clean up will come later, so you can ignore that part).  Things have been going okay until I got to a part where the table row values are an array of arrays.  I'm getting this error:</p>
  <p>Error:</p>
  <blockquote>
  <p>Expected class kotlinx.serialization.json.JsonObject as the serialized body of ...TableRow, but had class kotlinx.serialization.json.JsonArray</p>
  </blockquote>
  <p>Here is the part of the test JSON that is being parsed for this table:</p>
  <pre class="lang-json prettyprint-override"><code>{
   &quot;title&quot;: &quot;TRANSACTION HISTORY&quot;,
   &quot;type&quot;: &quot;Table&quot;,
   &quot;names&quot;: [
        &quot;Date&quot;,
        &quot;Amount&quot;,
        &quot;Lender&quot;,
        &quot;Borrower&quot;
     ],
      &quot;values&quot;: [
          [
             &quot;07\/01\/2014&quot;,
             &quot;$315,000&quot;,
             &quot;Steve's Lending Co.&quot;,
             &quot;Glenn Danzig&quot;
           ],
           [
             &quot;10\/13\/2011&quot;,
             &quot;$236,000&quot;,
             &quot;Feet Company&quot;,
             &quot;Marcus Toeswater&quot;
           ]
        ]
     },
     {
       &quot;title&quot;: &quot;ASSESSMENT &amp; TAX&quot;,
       &quot;type&quot;: &quot;Table&quot;,
       &quot;names&quot;: [
            &quot;Year&quot;,
            &quot;Property Taxes&quot;,
            &quot;Tax Assessment&quot;
       ],
       &quot;values&quot;: [
            [
              &quot;2017&quot;,
              &quot;$6,068&quot;,
              &quot;$395,000&quot;
            ],
            [
              &quot;2016&quot;,
              &quot;$5,864&quot;,
              &quot;$372,000&quot;
            ],
            [
              &quot;2015&quot;,
              &quot;$5,609&quot;,
              &quot;$341,500&quot;
            ]
        ]
     },
  </code></pre>
  <p>Here's the code I have right now.  I'm simply trying to post two rows of data:
  1 with the column header names, and
  1 with all of the row data (doesn't have to look nice at this point - I'm just trying to get the mapping done)</p>
  <pre><code>@Serializable
  @SerialName(&quot;Table&quot;)
  @Parcelize
  data class TableSection(
      override val title: String? = null,
      @SerialName(&quot;names&quot;)
      val columnHeader: ArrayList&lt;String?&gt; = arrayListOf(),
      @SerialName(&quot;values&quot;)
      val tableData: ArrayList&lt;TableRow&gt; = arrayListOf(),
  ) : Section() {
      @Composable
      override fun Content(modifier: Modifier) {
          return Column {
              Row {
                  columnHeader.map {
                      Text(it ?: &quot;&quot;)
                  }
              }
              Row {
                  tableData.map { row -&gt;
                      row.tableRowValues.map { value -&gt;
                          Text(value ?: &quot;&quot;)
                      }
                  }
              }
          }
      }
  }
  
  @Serializable
  @Parcelize
  data class TableRow(
      @Serializable
      val tableRowValues: ArrayList&lt;String?&gt; = arrayListOf(),
  ) : Parcelable
  </code></pre>
  <p>Note:  The Title and the Table Column Headers work just fine.  It's the table data that is throwing the error.</p>