code: private List<Map<String, Object>> selectionToList(CSLItemData[] selection) {
  		MapJsonBuilderFactory mjbf = new MapJsonBuilderFactory();
  		List<Map<String, Object>> sl = new ArrayList<>();
  		for (CSLItemData item : selection) {
  			JsonBuilder jb = mjbf.createJsonBuilder();
  			@SuppressWarnings("unchecked")
  			Map<String, Object> mi = (Map<String, Object>)item.toJson(jb);
  			for (Map.Entry<String, Object> e : mi.entrySet()) {
  				Object v = e.getValue();
  				if (e.getKey().equals("id") && v instanceof String &&
  						((String)v).startsWith("-GEN-")) {
  					//skip generated ids
  					continue;
  				}
  				if (v instanceof Collection) {
  					Collection<?> coll = (Collection<?>)v;
  					if (coll.isEmpty()) {
  						putSelectionFieldValue(sl, e, "");
  					} else {
  						for (Object ao : coll) {
  							putSelectionFieldValue(sl, e, ao);
  						}
  					}
  				} else if (v instanceof Map && ((Map<?, ?>)v).isEmpty()) {
  					putSelectionFieldValue(sl, e, "");
  				} else {
  					putSelectionFieldValue(sl, e, v);
  				}
  			}
  		}
  		return sl;
  	}
docs: Converts the given CSLItemData objects to a list of field/value pairs
  that can be used to filter bibliography items. Only those fields will
  be included that are actually set in the given objects.
  @param selection the CSLItemData objects
  @return the list of field/value pairs