fun matchtype(x) = x match {
  case is Object -> "OBJECT"
  case is String -> "STRING"
  case is Number -> "NUMBER"
  case is Boolean -> "BOOLEAN"
  case is Array -> "ARRAY"
  case is Null -> "NULL"
}
fun matchtype2(x) = x match {
  case y is Object -> { "type": "OBJECT", y: y }
  case y is String -> { "type": "STRING", y: y }
  case y is Number -> { "type": "NUMBER", y: y }
  case y is Boolean -> { "type": "BOOLEAN", y: y }
  case y is Array -> { "type": "ARRAY", y: y }
  case y is Null -> { "type": "NULL", y: y }
}
---
{
  a: matchtype(in0.a),
  b: matchtype(in0.b),
  c: matchtype(in0.c),
  d: matchtype(in0.d),
  aa: matchtype2(in0.a),
  ab: matchtype2(in0.b),
  ac: matchtype2(in0.c),
  ad: matchtype2(in0.d)
}