code: @Override
    public JsonElement serialize(ExpandableField<?> src, Type typeOfSrc,
        JsonSerializationContext context) {
      if (src.isExpanded()) {
        return context.serialize(src.getExpanded());
      } else if (src.getId() != null) {
        return new JsonPrimitive(src.getId());
      } else {
        return null;
      }
    }
docs: Serializes an expandable attribute into a JSON string.