JSONObject.Accumulate(String, Object) Method

Definition

Appends value to the array already mapped to name.

[Android.Runtime.Register("accumulate", "(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;", "GetAccumulate_Ljava_lang_String_Ljava_lang_Object_Handler")]
public virtual Org.Json.JSONObject Accumulate (string name, Java.Lang.Object? value);
[<Android.Runtime.Register("accumulate", "(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;", "GetAccumulate_Ljava_lang_String_Ljava_lang_Object_Handler")>]
abstract member Accumulate : string * Java.Lang.Object -> Org.Json.JSONObject
override this.Accumulate : string * Java.Lang.Object -> Org.Json.JSONObject

Parameters

name
String
value
Object

a JSONObject, JSONArray, String, Boolean, Integer, Long, Double, #NULL or null. May not be Double#isNaN() NaNs or Double#isInfinite() infinities.

Returns

Attributes

Exceptions

Remarks

Appends value to the array already mapped to name. If this object has no mapping for name, this inserts a new mapping. If the mapping exists but its value is not an array, the existing and new values are inserted in order into a new array which is itself mapped to name. In aggregate, this allows values to be added to a mapping one at a time.

Note that #append(String, Object) provides better semantics. In particular, the mapping for name will <b>always</b> be a JSONArray. Using accumulate will result in either a JSONArray or a mapping whose type is the type of value depending on the number of calls to it.

Java documentation for org.json.JSONObject.accumulate(java.lang.String, java.lang.Object).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to