in my java application, I'm reading a JSON array from a REST API.
Here is my code, which reads individual objects from a JSON array, and attempts to convert each JSON object to a strongly-types one:
JSONArray jsonArray = new JSONArray(videoFromMessage);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject custtableObject = jsonArray.getJSONObject(i);
ObjectMapper mapper = new ObjectMapper();
Custtable custTable = mapper.readValue(custtableObject.toString(), new TypeReference<Custtable >(){});
}
Each custTable object in that array contains a field named "modifieddatetime", with a value resembling this:
Fri Dec 31 18:00:00 CST 1
The readValue call throws this exception:
com.fasterxml.jackson.databind.exc.InvalidFormatException:
Can not construct instance of java.util.Date from String value 'Fri Dec 31 18:00:00 CST 1':
not a valid representation (error: Failed to parse Date value 'Fri Dec 31 18:00:00 CST 1':
Can not parse date "Fri Dec 31 18:00:00 CST 1":
not compatible with any of standard forms
("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd"))
Is there some method, function, utility, or an API, which I could call, to convert this field value to an acceptable format?