public static void writeNodeContentsToWriter(JSONWriter write, Node node) throws RepositoryException, JSONException { // Since removal of bigstore we add in jcr:path and jcr:name write.key("jcr:path"); write.value(PathUtils.translateAuthorizablePath(node.getPath())); write.key("jcr:name"); write.value(node.getName()); PropertyIterator properties = node.getProperties(); while (properties.hasNext()) { Property prop = properties.nextProperty(); String name = prop.getName(); write.key(name); PropertyDefinition propertyDefinition = prop.getDefinition(); int propertyType = prop.getType(); if (PropertyType.BINARY == propertyType) { if (propertyDefinition.isMultiple()) { write.array(); for (long l : prop.getLengths()) { write.value("binary-length:" + String.valueOf(l)); } write.endArray(); } else { write.value("binary-length:" + String.valueOf(prop.getLength())); } } else { if (propertyDefinition.isMultiple()) { Value[] values = prop.getValues(); write.array(); for (Value value : values) { Object ovalue = stringValue(value); if (isUserPath(name, ovalue)) { write.value(PathUtils.translateAuthorizablePath(ovalue)); } else { write.value(ovalue); } } write.endArray(); } else { Object value = stringValue(prop.getValue()); if (isUserPath(name, value)) { write.value(PathUtils.translateAuthorizablePath(value)); } else { write.value(value); } } } } }