I am trying to use Gson to deserialize a json array, but am currently getting a JsonSyntaxException. The json string was created by a .NET MVC3 web service using JsonResult (meaning, I am not manually creating the json, it is being created by a library which I know to work on several other platforms).
This is the json:
[{"PostID":1,"StudentID":39,"StudentName":"Joe Blow",
"Text":"Test message.","CreateDate":"\/Date(1350178408267)\/",
"ModDate":"\/Date(1350178408267)\/","CommentCount":0}]
This is the code:
public class Post {
public int PostID;
public int StudentID;
public String StudentName;
public String Text;
public Date CreateDate;
public Date ModDate;
public Post() { }
}
Type listOfPosts = new TypeToken<ArrayList<Post>>(){}.getType();
ArrayList<Post> posts = new Gson().fromJson(json, listOfPosts);
The exception says that the date format is invalid:
com.google.gson.JsonSyntaxException: /Date(1350178408267)/
Anyone know what is going on?