code: public static List<JSONObject> toList(JSONObject parent, String propertyName) {
          Object v = parent.get(propertyName);
          if(v==null)
              return Collections.emptyList();
          if(v instanceof JSONObject)
              return Collections.singletonList((JSONObject)v);
          if(v instanceof JSONArray)
              return (List)(JSONArray)v;
  
          throw new IllegalArgumentException();
      }
docs: Retrieves the property of the given object and returns it as a list of {@link JSONObject}.
  
  <p>
  If the value doesn't exist, this method returns an empty list. If the value is
  a {@link JSONObject}, this method will return a singleton list. If it's a {@link JSONArray},
  the contents will be returned as a list.
  
  <p>
  Because of the way structured form submission work, this is convenient way of
  handling repeated multi-value entries.
  
  @since 1.233