Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix exception when using json output flag
Browse files Browse the repository at this point in the history
fixes the following exception, which breaks usage with ksdump:

   Exception in thread "main" scala.MatchError: ArrayBuffer(...)
smx-smx committed Mar 16, 2024
1 parent 8aeb79a commit 81bc35e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions shared/src/main/scala/io/kaitai/struct/JSON.scala
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ package io.kaitai.struct

import io.kaitai.struct.translators.CommonLiterals

import scala.collection.mutable.ArrayBuffer

/** Common trait for all objects that can be serialized as JSON. */
trait Jsonable {
/** Serialize current state of the object into JSON string. */
@@ -24,6 +26,7 @@ object JSON extends CommonLiterals {
case v: String => stringToJson(v)
case v: Seq[_] => seqToJson(v)
case v: Map[String, _] => mapToJson(v)
case v: ArrayBuffer[_] => seqToJson(v.toSeq)
}
}

0 comments on commit 81bc35e

Please sign in to comment.