Returns a map of string keys and values. This is similar to a JSON object,
with '{' and '}' surrounding the map, ':' separating keys from values, and
',' separating entries.
177304
@SuppressWarnings("unchecked")
  private Map<String, Object> readMap(char openBrace, char closeBrace, char keyValueSeparator) {
    if (readChar() != openBrace) throw new AssertionError();
    Map<String, Object> result = new LinkedHashMap<>();
    while (true) {
      if (peekChar() == closeBrace) {
        // If we see the close brace, finish immediately. This handles {}/[] and ,}/,] cases.
        pos++;
        return result;
      }

      OptionElement option = readOption(keyValueSeparator);
      String name = option.name();
      Object value = option.value();
      if (value instanceof OptionElement) {
        @SuppressWarnings("unchecked")
        Map<String, Object> nested = (Map<String, Object>) result.get(name);
        if (nested == null) {
          nested = new LinkedHashMap<>();
          result.put(name, nested);
        }
        OptionElement valueOption = (OptionElement) value;
        nested.put(valueOption.name(), valueOption.value());
      } else {
        // Add the value(s) to any previous values with the same key
        Object previous = result.get(name);
        if (previous == null) {
          result.put(name, value);
        } else if (previous instanceof List) {
          // Add to previous List
          addToList((List<Object>) previous, value);
        } else {
          List<Object> newList = new ArrayList<>();
          newList.add(previous);
          addToList(newList, value);
          result.put(name, newList);
        }
      }

      // ',' separator is optional, skip if present
      if (peekChar() == ',') {
        pos++;
      }
    }
  }
917327
def extract_key_values(array_value, separators=(';', ',', ':'), **kwargs):
    
    items_sep, fields_sep, keys_sep = separators
    return items_sep.join(fields_sep.join(keys_sep.join(x) for x in sorted(it.items()))
                          for it in array_value)
585601
private Map<String, String[]> parseQueryString(String data) {
        Map<String, String[]> map = new Hashtable<String, String[]>();
        if (null == data) {
            return map;
        }
        String valArray[] = null;
        char[] chars = data.toCharArray();
        int key_start = 0;
        for (int i = 0; i < chars.length; i++) {
            // look for the key name delimiter
            if ('=' == chars[i]) {
                if (i == key_start) {
                    // missing the key name
                    throw new IllegalArgumentException("Missing key name: " + i);
                }
                String key = parseName(chars, key_start, i);
                int value_start = ++i;
                for (; i < chars.length && '&' != chars[i]; i++) {
                    // just keep looping looking for the end or &
                }
                if (i > value_start) {
                    // did find at least one char for the value
                    String value = parseName(chars, value_start, i);
                    if (map.containsKey(key)) {
                        String oldVals[] = map.get(key);
                        valArray = new String[oldVals.length + 1];
                        System.arraycopy(oldVals, 0, valArray, 0, oldVals.length);
                        valArray[oldVals.length] = value;
                    } else {
                        valArray = new String[] { value };
                    }
                    map.put(key, valArray);
                }
                key_start = i + 1;
            }
        }
        return map;
    }
900439
public static Map<String, String> mapStringToMap(String map) {
    String[] m = map.split("[,;]");
    Map<String, String> res = new HashMap<String, String>();
    for (String str : m) {
      int index = str.lastIndexOf('=');
      String key = str.substring(0, index);
      String val = str.substring(index + 1);
      res.put(key.trim(), val.trim());
    }
    return res;
  }
120210
public Map<String, String> toMap() {
        Map<String, String> result = new LinkedHashMap<String, String>();
        for (int i = 0, size = size(); i < size; i++) {
            String name = name(i);
            String values = result.get(name);
            if (values == null) {
                values = value(i);
            } else {
                values += ", " + value(i);
            }
            result.put(name, values);
        }
        return result;
    }
1372528
public Map<String, String> getKeywordMap() {
        if (keywords == null) {
            TreeMap<String, String> m = null;
            if (setToKeywordStart()) {
                // trim spaces and convert to lower case, both keywords and values.
                do {
                    String key = getKeyword();
                    if (key.length() == 0) {
                        break;
                    }
                    char c = next();
                    if (c != KEYWORD_ASSIGN) {
                        // throw new IllegalArgumentException("key '" + key + "' missing a value.");
                        if (c == DONE) {
                            break;
                        } else {
                            continue;
                        }
                    }
                    String value = getValue();
                    if (value.length() == 0) {
                        // throw new IllegalArgumentException("key '" + key + "' missing a value.");
                        continue;
                    }
                    if (m == null) {
                        m = new TreeMap<String, String>(getKeyComparator());
                    } else if (m.containsKey(key)) {
                        // throw new IllegalArgumentException("key '" + key + "' already has a value.");
                        continue;
                    }
                    m.put(key, value);
                } while (next() == ITEM_SEPARATOR);
            }
            keywords = m != null ? m : Collections.<String, String>emptyMap();
        }

        return keywords;
    }
861746
static String mapEntryToString(Object key, Object val) {
        final String k, v;
        final int klen, vlen;
        final char[] chars =
            new char[(klen = (k = objectToString(key)).length()) +
                     (vlen = (v = objectToString(val)).length()) + 1];
        k.getChars(0, klen, chars, 0);
        chars[klen] = '=';
        v.getChars(0, vlen, chars, klen + 1);
        return new String(chars);
    }
319405
def serialize(self, items):
        
        r = StringIO()
        for key, value in items.items():
            if isinstance(value, list):
                # handle special case of lists
                value = "["+", ".join(map(str, value))+"]"
            r.write("%s = %s\n" % (key, value))
        return r.getvalue()
290045
private Map<String, String> toMap(JsonNode messageJson) {
        Map<String, String> fields = new HashMap<String, String>(messageJson.size());
        Iterator<Map.Entry<String, JsonNode>> jsonFields = messageJson.fields();
        while (jsonFields.hasNext()) {
            Map.Entry<String, JsonNode> next = jsonFields.next();
            fields.put(next.getKey(), next.getValue().asText());
        }
        return fields;
    }
137870
def stringify_values(data):
    
    if not isinstance(data, dict):
        raise ValueError('Data must be dict. %r is passed' % data)

    values_dict = {}
    for key, value in data.items():
        items = []
        if isinstance(value, six.string_types):
            items.append(value)
        elif isinstance(value, Iterable):
            for v in value:
                # Convert to str int values
                if isinstance(v, int):
                    v = str(v)
                try:
                    item = six.u(v)
                except TypeError:
                    item = v
                items.append(item)
            value = ','.join(items)
        values_dict[key] = value
    return values_dict
288630
function() {
			return gui.Object.map(this, function(key, value) {
				var c = key.charAt(0);
				if (c !== "$" && c !== "_") {
					if (edb.Type.is(value)) {
						return value.toJSON();
					}
					return value;
				}
			});
		}
277026
public Map<String, String> toMap(){
		Map<String, String> ret = new HashMap<>();
		ret.put("id", this.getID());
		ret.put("version", this.getVersion().toString());
		return ret;
	}
271414
def values(self):
        
        return dict((k, getattr(self, k)) for k in self._keys)
633594
public Map<String, Object> jsonStringToMap(String jsonString) {
        if (StringUtils.isEmpty(jsonString)) {
            return null;
        }
        JSONObject jsonObject;
        try {
            jsonObject = new JSONObject(jsonString);
            return jsonObjectToMap(jsonObject);
        } catch (JSONException e) {
            throw new RuntimeException("Unable to convert string to map: " + jsonString, e);
        }
    }
869631
def get_mapping(self):  # TODO: rename to _as_dict
        
        return {
            key: val
            for key, val in self.__dict__.iteritems()
            if val
        }
724125
public Map<String, Object> toJson() {
    Map<String, Object> json = new HashMap<>();
    json.put("browserTimeout", browserTimeout);
    json.put("debug", debug);
    json.put("jettyMaxThreads", jettyMaxThreads);
    json.put("log", log);
    json.put("host", host);
    json.put("port", port);
    json.put("role", role);
    json.put("timeout", timeout);

    serializeFields(json);

    return json.entrySet().stream()
        .filter(entry -> entry.getValue() != null)
        .collect(toImmutableSortedMap(natural(), Map.Entry::getKey, Map.Entry::getValue));
  }
415168
private Map<String,Object> getMap()
    {
        if (m_data == null)
            m_data = new HashMap<String,Object>();
        return (Map<String, Object>)m_data;
    }