title: Sometimes can't parse date from json using gson
body: <p>I am using gson 2.4 in my app in order to parse json object. The flow of the app is: get login json from server - save it to shared preference - get it when i need and parse back to a json object.</p>
  
  <p>Example of a problematic json that I got from the server:</p>
  
  <pre><code>{".expires":"Mar 16, 2017 5:52:29 PM",".issued":"Dec 16, 2016 5:52:29 PM","access_token":"**"}
  </code></pre>
  
  <p>My code when i am getting the json back from shared preferences:</p>
  
  <pre><code>SharedPreferences settings = activity.getSharedPreferences("UserInfo", 0);        
  String json = settings.getString("LoginToken", null);
  Gson gson = new GsonBuilder().setDateFormat(Settings.DateFormat).create();
  loginToken = gson.fromJson(json, LoginToken.class);
  </code></pre>
  
  <p>On the last line when i am using <code>gson.fromJson</code> I am getting an exception.</p>
  
  <p>So  i tried to parse this json in my eclipse using this code:</p>
  
  <pre><code>String raw = "{\".expires\":\"Mar 16, 2017 5:52:29 PM\",\".issued\":\"Dec 16, 2016 5:52:29 PM\",\"access_token\":\"**"}";
  Gson gson = new GsonBuilder().setDateFormat(Settings.DateFormat).create();
  LoginToken loginToken = gson.fromJson(raw, LoginToken.class);
  </code></pre>
  
  <p>and it produced this exception:</p>
  
  <pre><code>Exception in thread "main" com.google.gson.JsonSyntaxException: Mar 16, 2017 5:52:29 PM
  at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:107)
  at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:82)
  at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:35)
  at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)
  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:117)
  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:217)
  at com.google.gson.Gson.fromJson(Gson.java:814)
  at com.google.gson.Gson.fromJson(Gson.java:779)
  at com.google.gson.Gson.fromJson(Gson.java:728)
  at com.google.gson.Gson.fromJson(Gson.java:700)
  at **.Main.main(Main.java:33)
  Caused by: java.text.ParseException: Unparseable date: "Mar 16, 2017 5:52:29 PM"
      at java.text.DateFormat.parse(Unknown Source)
      at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:105)
  </code></pre>
  
  <p>The date format i use is:</p>
  
  <pre><code>DateFormat = "dd/MM/yyyy'T'HH:mm:ss";
  </code></pre>
  
  <p>Also tried to replace the <code>'T'</code> with a space but it didn't fix that.</p>
  
  <p>How can i fix it?</p>