public class Period {
Instant startsAt;
Instant endsAt;
}
final Period period = Json.decodeValue(rc.getBodyAsString(), Period.class);
{
"startsAt": "2017-02-17T19:00:00Z",
"endsAt": "2017-02-20T06:00:00Z"
}
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.7.4'
We need the jackson datatype module, but we don't have access to the json ObjectMapper to register the module from Json class in vertx.
1- I can leave as string and convert to Instant on my own.
2- Register my own Object mapper for just 2 properties and use JsonObject everywhere else.
3- Pass around JsonObject to the "services" since it supports getInstant. I suppose its the most interoperable way.
private Instant startsAt;
@JsonSetter
public setStartAt(String instantString) {
//do your conversion
}
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/15299d76-bc86-4981-a791-a8a644f055e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.