I am trying to parse JSON data using Jackson, found that instance some time as array or String
JSON DATA instance with String :
{
"Value" : "1"
}
JSON DATA instatnce with Array :
{
"Value" : ["ram","kumar"]
}
due to this getting error are given below
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot
deserialize instance of `java.util.ArrayList` out of VALUE_STRING token
In this case how to solve this,thankyou
current java code
ObjectMapper objectMapper = new ObjectMapper();
try {
String jsonInString = objectMapper.writeValueAsString(products.get(j));
InventoryParser inventoryParser =
objectMapper.readValue(jsonInString, InventoryParser.class);
System.out.println(inventoryParser.getName());
}
catch (IOException e)
{
e.printStackTrace();
}
}