Converts this object to something serializable in JSON.
@override Object toJson() => <Object>[_patternItemTypeToJson(type), length];