Skip to content

Commit e31f147

Browse files
committed
--ksc-json-output: fix scala.MatchError on ArrayBuffer for Scala 2.13
Closes #279
1 parent 7d4093f commit e31f147

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

shared/src/main/scala/io/kaitai/struct/JSON.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.kaitai.struct
22

33
import io.kaitai.struct.translators.CommonLiterals
4+
import scala.collection
45

56
/** Common trait for all objects that can be serialized as JSON. */
67
trait Jsonable {
@@ -22,7 +23,7 @@ object JSON extends CommonLiterals {
2223
case v: Jsonable => v.toJson
2324
case v: Int => v.toString
2425
case v: String => stringToJson(v)
25-
case v: Seq[_] => seqToJson(v)
26+
case v: collection.Seq[_] => seqToJson(v)
2627
case v: Map[String, _] => mapToJson(v)
2728
}
2829
}
@@ -33,7 +34,7 @@ object JSON extends CommonLiterals {
3334
def stringToJson(str: String): String =
3435
doStringLiteral(str)
3536

36-
def seqToJson(obj: Seq[_]): String =
37+
def seqToJson(obj: collection.Seq[_]): String =
3738
"[" + obj.map((x) => stringify(x)).mkString(",") + "]"
3839

3940
def mapToJson(obj: Map[String, Any]): String = {

0 commit comments

Comments
 (0)