I am trying to convert a json string to JSONArray of org.json.JSONArray class, the string contains a dateformat with forward slah, but I am getting the following exception because of the slash included in string.
public static void main(String args[]) throws JSONException{
String jsonString = "[{ID:1, Name:Ann, DOB:14/08/1991}, {ID:2, Name:Vann, DOB:14/08/1992}]";
JSONArray jsonArray = new JSONArray(jsonString);
System.out.println(jsonArray.toString());
}
Exception in thread "main" org.json.JSONException: Expected a ',' or '}' at 25 [character 26 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:451)
at org.json.JSONObject.<init>(JSONObject.java:230)
at org.json.JSONTokener.nextValue(JSONTokener.java:380)
at org.json.JSONArray.<init>(JSONArray.java:118)
at org.json.JSONArray.<init>(JSONArray.java:147)
at com.s4m.sftp.service.impl.SFTPServiceImpl.main(SFTPServiceImpl.java:1150)