public JSONBuffer appendKeyValue(Object key,Object val){
  if (stack.empty() || stack.peek() != Operand.HASH) {
    throw new JSONException("Appending key-value outside of hash context.");
  }
  addQuotedString(key);
  buffer.append(":");
  if (val instanceof Double) {
    buffer.append(val.toString());
  }
 else   if (val instanceof Integer) {
    buffer.append(val.toString());
  }
 else {
    addQuotedString(val);
  }
  buffer.append(",");
  return this;
}

public JSONBuffer appendKeyValue ( Object key , Object val ) { if ( stack . empty ( ) || stack . peek ( ) != Operand . HASH ) { throw new JSONException ( "Appending key-value outside of hash context." ) ; } addQuotedString ( key ) ; buffer . append ( ":" ) ; if ( val instanceof Double ) { buffer . append ( val . toString ( ) ) ; } else if ( val instanceof Integer ) { buffer . append ( val . toString ( ) ) ; } else { addQuotedString ( val ) ; } buffer . append ( "," ) ; return this ; }
append a key - value pair as string .
