public static void addItemsFromString(String string, WeightedSetItem out) {
        var s = new ParsableString(string);
        switch (s.peek()) {
            case '[' : addArrayItems(s, out); break;
            case '{' : addMapItems(s, out); break;
            default : throw new IllegalArgumentException("Expected a string starting by '[' or '{', " +
                                                         "but was '" + s.peek() + "'");
        }
    }
Parser of parameter lists on the form {key:value, key:value} or [[key,value], [key,value], ...]

@author bratseth
container-search/src/main/java/com/yahoo/search/yql/ParameterListParser.java