protected void writeListProperty(JsonGenerator jg, Property prop) throws IOException {
   jg.writeStartArray();
   if (prop instanceof ArrayProperty) {
     Object[] ar = (Object[]) prop.getValue();
     if (ar == null) {
       jg.writeEndArray();
       return;
     }
     Type itemType = ((ListType) prop.getType()).getFieldType();
     ObjectResolver resolver = itemType.getObjectResolver();
     String path = prop.getPath();
     for (Object o : ar) {
       if (!fetchProperty(jg, resolver, o, path)) {
         writeScalarPropertyValue(jg, ((SimpleType) itemType).getPrimitiveType(), o);
       }
     }
   } else {
     ListProperty listp = (ListProperty) prop;
     for (Property p : listp.getChildren()) {
       writeProperty(jg, p);
     }
   }
   jg.writeEndArray();
 }
 @Override
 public Object visit(ListProperty property, Object arg) throws PropertyException {
   Object value = null;
   if (property.isContainer()) {
     value = new JSONArray();
   } else {
     value = property.getValue();
   }
   if (property.getParent() instanceof BlobProperty) {
     log.warn(
         "Property '"
             + property.getName()
             + "' ignored during serialization. Blob and blob related properties are not written to json object.");
   } else if (property.getParent().isList()) {
     ((JSONArray) arg).add(value);
   } else {
     try {
       ((JSONObject) arg).put(property.getField().getName().getPrefixedName(), value);
     } catch (JSONException e) {
       throw new PropertyException("Failed to put value", e);
     }
   }
   return value;
 }