JSONObject.Wrap(Object) Method

Definition

Wraps the given object if necessary.

[Android.Runtime.Register("wrap", "(Ljava/lang/Object;)Ljava/lang/Object;", "")]
public static Java.Lang.Object? Wrap (Java.Lang.Object? o);
[<Android.Runtime.Register("wrap", "(Ljava/lang/Object;)Ljava/lang/Object;", "")>]
static member Wrap : Java.Lang.Object -> Java.Lang.Object

Parameters

o
Object

Returns

Attributes

Remarks

Wraps the given object if necessary.

If the object is null or , returns #NULL. If the object is a JSONArray or JSONObject, no wrapping is necessary. If the object is NULL, no wrapping is necessary. If the object is an array or Collection, returns an equivalent JSONArray. If the object is a Map, returns an equivalent JSONObject. If the object is a primitive wrapper type or String, returns the object. Otherwise if the object is from a java package, returns the result of toString. If wrapping fails, returns null.

Java documentation for org.json.JSONObject.wrap(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