diff --git a/wrangler-core/src/main/java/io/cdap/wrangler/utils/RecordConvertor.java b/wrangler-core/src/main/java/io/cdap/wrangler/utils/RecordConvertor.java index 1b7e995a4..90b55266a 100644 --- a/wrangler-core/src/main/java/io/cdap/wrangler/utils/RecordConvertor.java +++ b/wrangler-core/src/main/java/io/cdap/wrangler/utils/RecordConvertor.java @@ -37,6 +37,7 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeParseException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import javax.annotation.Nullable; @@ -434,10 +435,9 @@ private List decodeArray(String name, Object object, Schema schema) thro return decodeArray(name, (List) object, schema); } else if (object instanceof JsonArray) { return decodeArray(name, (JsonArray) object, schema); + } else { + return decodeArray(name, Collections.singletonList(object), schema); } - throw new RecordConvertorException( - String.format("Unable to decode array '%s'", name) - ); } private List decodeArray(String name, JsonArray list, Schema schema) throws RecordConvertorException {