JSONObject.Wrap(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
The Java object to convert to a JSON-compatible value, or null.
Returns
Null for a null reference; an existing JSON object, JSON array, null sentinel, Java primitive wrapper, or Java string unchanged; a JSON array for a Java array or collection; or a JSON object for a Java map. Other objects from a java. package are converted with their Java toString() method. Returns null if the object is unsupported or wrapping fails.
- 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.