code: private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
          boolean isValueNumeric = false;
  
          try {
              if (value.equals("0") || !value.endsWith("0")) {
                  Double.parseDouble(value);
                  isValueNumeric = true;
              }
          } catch (NumberFormatException e) {
              isValueNumeric = false;
          }
  
          if (json.charAt(json.length() - 1) != '{') {
              json.append(',');
          }
  
          json.append(escapeJSON(key));
          json.append(':');
  
          if (isValueNumeric) {
              json.append(value);
          } else {
              json.append(escapeJSON(value));
          }
      }
docs: Appends a json encoded key/value pair to the given string builder.
  
  @param json
  @param key
  @param value
  @throws UnsupportedEncodingException