Skip to content

Support for Java 8 date/time types. #28

Closed
@itanor

Description

@itanor

Hi, at the moment the library is not supporting Java 8 date/time types like LocalDateTime?

I saw in the source code that has no writer for LocalDateTime type, eg.
Is there a way to extend some class or other way to make it work for Java 8 types?

I am using jackson-datatype-jsr310 in Spring Boot with serializer and deserializer and works fine. But when I use code like that

json.use(JsonView.with(obj).onClass(Obj.class, match().exclude("foo"))).returnValue()

it's not respecting the serializer of the annotation. I have this code:

@JsonSerialize(using = CustomLocalDateTimeSerializer.class)
private LocalDateTime someDate;

CustomLocalDateTimeSerializer serialize to milliseconds, but the code of CustomLocalDateTimeSerializer it's not invoked when I use the library.

The result in JSON for LocalDateTime is

someDate":{
  "date":{
    "year":2016,
    "month":7,
    "day":22
  },
  "time":{
    "hour":20,
    "minute":16,
    "second":27,
    "nano":881000000
  }
}

Thanks, and great library...
Itanor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions