Hi,
I am getting a null pointer exception in the above method as you are expecting optional members.
This is particularly happening to me for "links".
// optional top-level member: links
// a links object containing links related to the resource.
JsonObject links = datum.get("links").asObject();
datum.get("links") returns null.