code: @Override
    public JsonElement serialize(CMAField field, Type type, JsonSerializationContext context) {
      JsonObject json = new JsonObject();
  
      add(json, ATTR_ID, field.getId());
      add(json, ATTR_NAME, field.getName());
      add(json, ATTR_TYPE, field.getType());
      add(json, ATTR_LINK_TYPE, field.getLinkType());
      add(json, ATTR_REQUIRED, field.isRequired());
      add(json, ATTR_DISABLED, field.isDisabled());
      add(json, ATTR_OMITTED, field.isOmitted());
      add(json, ATTR_LOCALIZED, field.isLocalized());
  
      List<Map<String, Object>> validations = field.getValidations();
      if (validations != null) {
        json.add(ATTR_VALIDATIONS, context.serialize(validations,
            new TypeToken<List<Map<String, Object>>>() {
            }
            .getType()));
      }
  
      Map<String, Object> arrayItems = field.getArrayItems();
      if (arrayItems != null) {
        json.add(ATTR_ARRAY_ITEMS, context.serialize(arrayItems, Map.class));
      }
  
      return json;
    }
docs: Serialize all fields for content types.
  
  @param field   the content type field to be serialized
  @param type    the type to be used.
  @param context the json context to be used.
  @return a json object representing the field.