Language

JSONArray.ToJSONObject(JSONArray) Method

Definition

Returns a new object whose values are the values in this array, and whose names are the values in names.

[Android.Runtime.Register("toJSONObject", "(Lorg/json/JSONArray;)Lorg/json/JSONObject;", "GetToJSONObject_Lorg_json_JSONArray_Handler")]
public virtual Org.Json.JSONObject? ToJSONObject(Org.Json.JSONArray? names);
[<Android.Runtime.Register("toJSONObject", "(Lorg/json/JSONArray;)Lorg/json/JSONObject;", "GetToJSONObject_Lorg_json_JSONArray_Handler")>]
abstract member ToJSONObject : Org.Json.JSONArray -> Org.Json.JSONObject
override this.ToJSONObject : Org.Json.JSONArray -> Org.Json.JSONObject

Parameters

names
JSONArray

The array of names to pair with this array's values by index. Non-string names are converted to strings. Must not be null.

Returns

A new object with pairs up to the shorter array's length, or null if either array is empty. A value that is a null reference produces no mapping; Null is retained as a value.

Attributes

Exceptions

Remarks

Returns a new object whose values are the values in this array, and whose names are the values in names. Names and values are paired up by index from 0 through to the shorter array's length. Names that are not strings will be coerced to strings. This method returns null if either array is empty.

Java documentation for org.json.JSONArray.toJSONObject(org.json.JSONArray).

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