Um, how are we supposed to help if you don't provide either: 1. Classes you use for reading/writing 2. JSON being read (or expected to be written)
? Including list of symptoms may help but these two things are the most important. -+ Tatu +- On Fri, Feb 17, 2017 at 1:54 PM, vivek sharma <vivek.gurukul1...@gmail.com> wrote: > HI Mates - I am getting the below intermittent errors using Jackson api to > serialize and to deserialize, When I give one or 2 messages in JSON Array I > don't see this error but getting when JSON messages are more than 2: > > > > com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input > within/between Array entries > at [Source: [B@43fd9452; line: 1, column: 5313] > > com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize > instance of java.util.ArrayList out of START_OBJECT token > > > Code is like below: > > final Deserializer<List<BusinessProcess>> jsonDsr = new > Deserializer<List<BusinessProcess>>() { > @Override > public void configure(Map<String, ?> configs, boolean isKey) { > } > > @Override > public List<BusinessProcess> deserialize(String topic, byte[] > data) { > JsonFactory factory = new JsonFactory(); > factory.enable(JsonParser.Feature.IGNORE_UNDEFINED); > factory.enable(JsonParser.Feature.ALLOW_MISSING_VALUES); > ObjectMapper objectMapper = new ObjectMapper(factory); > > > /* > objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, > true);*/ > > objectMapper.configure(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY, > true); > // > objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, > true); > > List<BusinessProcess> userFromJSON = null; > try { > > userFromJSON = objectMapper.reader().forType(new > TypeReference<List<BusinessProcess>>() {}).readValue(data); > /* TypeFactory typeFactory = > objectMapper.getTypeFactory(); > CollectionType collectionType = > typeFactory.constructCollectionType( > List.class, BusinessProcessesList.class);*/ > /* userFromJSON = objectMapper.readValue(data, new > TypeReference<List<BusinessProcess>>() { > });*/ > // > userFromJSON=objectMapper.readValue(data,BusinessProcessesList.class); > } catch (Exception e) { > e.printStackTrace(); > } > return userFromJSON; > } > > @Override > public void close() { > > } > }; > > -- > You received this message because you are subscribed to the Google Groups > "jackson-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jackson-user+unsubscr...@googlegroups.com. > To post to this group, send email to jackson-user@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user+unsubscr...@googlegroups.com. To post to this group, send email to jackson-user@googlegroups.com. For more options, visit https://groups.google.com/d/optout.