Put a key/value pair in the JSONObject, where the value will be a
JSONArray which is produced from a Collection.

@param key A key string.
@param value A Collection value.
@return this.
@throws JSONException If the value is invalid
973620
public JSONObject put(String key, Collection<?> value) throws JSONException {
		this.put(key, new JSONArray(value));
		return this;
	}
286251
public JSONObject putOnce(Enum<?> key, Object value) throws JSONException {
		return putOnce(key.name(), value);
	}
1239532
@Override
    public Object put(String key, Object value) {
        updatedKeys.add(key);

        return delegate.put(key, value);
    }
1222082
public JsonArray add(Object value) {
        if (value == this) {
            throw new IllegalArgumentException("Cannot add self");
        } else if (value == JsonValue.NULL) {
            addNull();
        } else if (checkType(value)) {
            content.add(value);
        } else {
            throw new IllegalArgumentException("Unsupported type for JsonArray: " + value.getClass());
        }
        return this;
    }
369077
public ContentValues put(String key, String value) {
        mValues.put(key, value);
        return this;
    }
1278461
public JsonWriter property(String key, Object value) throws IOException {
      Preconditions.checkArgument(!inArray(), "Cannot write a property inside an array.");
      writeName(key);
      value(value);
      return this;
   }
538461
protected void setJsonValue(JsonObjectBuilder builder, T value) {
    // I don't like this - there should really be a way to construct a disconnected JSONValue...
    if (value instanceof Boolean) {
      builder.add("value", (Boolean) value);
    } else if (value instanceof Double) {
      builder.add("value", (Double) value);
    } else if (value instanceof Integer) {
      builder.add("value", (Integer) value);
    } else if (value instanceof Long) {
      builder.add("value", (Long) value);
    } else if (value instanceof BigInteger) {
      builder.add("value", (BigInteger) value);
    } else if (value instanceof BigDecimal) {
      builder.add("value", (BigDecimal) value);
    } else if (value == null) {
      builder.addNull("value");
    } else {
      builder.add("value", value.toString());
    }
  }
903952
public final AssociativeArray put(Object key, AssociativeArray value) {
        return internalData.put(key, value);
    }
702793
public JSONObject put(Enum<?> key, boolean value) throws JSONException {
		return put(key.name(), value);
	}
567136
public JSONNavi<T> set(String key, double value) {
		return set(key, Double.valueOf(value));
	}
323234
public JSONObject put(String key, boolean value) throws JSONException {
        return this.put(key, value ? Boolean.TRUE : Boolean.FALSE);
    }
499039
public JSONArray element( Map value, JsonConfig jsonConfig ) {
      if( value instanceof JSONObject ){
         elements.add( value );
         return this;
      }else{
         return element( JSONObject.fromObject( value, jsonConfig ) );
      }
   }
610893
public @Nonnull JsonBuilder putArray(String key, String... values) {
        JsonArray jjArray = new JsonArray();
        for (String string : values) {
            jjArray.add(primitive(string));
        }
        object.put(key, jjArray);
        return this;
    }
362450
public JSONStringer value(boolean value) throws JSONException {
		if (this.stack.isEmpty()) {
			throw new JSONException("Nesting problem");
		}
		beforeValue();
		this.out.append(value);
		return this;
	}
688766
public static <T> JsonObjectBase buildObjectSuccess(String key, T value) {

        JsonObject json = new JsonObject();
        json.addData(key, value);

        LOG.info(json.toString());

        return json;
    }
659084
public static void jsonValue(JsonWriter writer, Object value) throws IOException {
        if (value == null) {
            writer.nullValue();
        } else {
            if (value instanceof Map) {
                jsonMap(writer, (Map<String, Object>) value);
            } else if (value instanceof Collection) {
                writer.beginArray();
                for (Object val : ((Collection) value)) {
                    jsonValue(writer, val);
                }
                writer.endArray();
            } else if (value instanceof Object[]) {
                writer.beginArray();
                for (Object val : ((Object[]) value)) {
                    jsonValue(writer, val);
                }
                writer.endArray();
            } else if (value instanceof Boolean) {
                writer.value((Boolean) value);
            } else if (value instanceof Long) {
                writer.value((Long) value);
            } else if (value instanceof Double) {
                writer.value((Double) value);
            } else if (value instanceof Number) {
                writer.value((Number) value);
            } else {
                writer.value(value.toString());
            }
        }
    }
16973
@SuppressWarnings({ "rawtypes", "unchecked" })
    private void writeJSON(Object value) throws JSONException {
        if (JSONObject.NULL.equals(value)) {
            write(zipNull, 3);
        } else if (Boolean.FALSE.equals(value)) {
            write(zipFalse, 3);
        } else if (Boolean.TRUE.equals(value)) {
            write(zipTrue, 3);
        } else {
            if (value instanceof Map) {
                value = new JSONObject((Map) value);
            } else if (value instanceof Collection) {
                value = new JSONArray((Collection) value);
            } else if (value.getClass().isArray()) {
                value = new JSONArray(value);
            }
            if (value instanceof JSONObject) {
                write((JSONObject) value);
            } else if (value instanceof JSONArray) {
                write((JSONArray) value);
            } else {
                throw new JSONException("Unrecognized object");
            }
        }
    }