>> The JSON spec does define date or calendar types, so JSONSerializer does not
>> support them.
> That's the real question for this, because usually beans used as a
> data model (for example for business applications) many times have
> data directly not supported, so the idea to provide something
> extendable (in application-specific code) instead of throwing
> exception ... but just as idea.
You can still use Dates in your model - you just need to define a setter that
takes a String and converts it to a Date. For example:
public Date getStartDate() { … }
public void setStartDate(Date startDate) {…}
public void setStartDate(String startDate) {
setDate(Date.valueOf(startDate);
}
Then, given the following content, JSONSerializer will correctly populate the
"startDate" property:
{ startDate:"2012-05-04" }
G