JSONObject Constructors

Definition

Overloads

JSONObject()

Creates a JSONObject with no name/value mappings.

JSONObject(JSONTokener)

Creates a new JSONObject with name/value mappings from the next object in the tokener.

JSONObject(IDictionary)

Creates a new JSONObject by copying all name/value mappings from the given map.

JSONObject(String)

Creates a new JSONObject with name/value mappings from the JSON string.

JSONObject(JSONObject, String[])

Creates a new JSONObject by copying mappings for the listed names from the given object.

JSONObject(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

JSONObject()

Creates a JSONObject with no name/value mappings.

[Android.Runtime.Register(".ctor", "()V", "")]
public JSONObject ();
Attributes

Remarks

Creates a JSONObject with no name/value mappings.

Java documentation for org.json.JSONObject.JSONObject().

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

JSONObject(JSONTokener)

Creates a new JSONObject with name/value mappings from the next object in the tokener.

[Android.Runtime.Register(".ctor", "(Lorg/json/JSONTokener;)V", "")]
public JSONObject (Org.Json.JSONTokener readFrom);
[<Android.Runtime.Register(".ctor", "(Lorg/json/JSONTokener;)V", "")>]
new Org.Json.JSONObject : Org.Json.JSONTokener -> Org.Json.JSONObject

Parameters

readFrom
JSONTokener

a tokener whose nextValue() method will yield a JSONObject.

Attributes

Exceptions

if the parse fails or doesn't yield a JSONObject.

Remarks

Creates a new JSONObject with name/value mappings from the next object in the tokener.

Java documentation for org.json.JSONObject.JSONObject(org.json.JSONTokener).

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

JSONObject(IDictionary)

Creates a new JSONObject by copying all name/value mappings from the given map.

[Android.Runtime.Register(".ctor", "(Ljava/util/Map;)V", "")]
public JSONObject (System.Collections.IDictionary copyFrom);
[<Android.Runtime.Register(".ctor", "(Ljava/util/Map;)V", "")>]
new Org.Json.JSONObject : System.Collections.IDictionary -> Org.Json.JSONObject

Parameters

copyFrom
IDictionary

a map whose keys are of type String and whose values are of supported types.

Attributes

Exceptions

if any of the map's keys are null.

Remarks

Creates a new JSONObject by copying all name/value mappings from the given map.

Java documentation for org.json.JSONObject.JSONObject(java.util.Map).

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

JSONObject(String)

Creates a new JSONObject with name/value mappings from the JSON string.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")]
public JSONObject (string json);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")>]
new Org.Json.JSONObject : string -> Org.Json.JSONObject

Parameters

json
String

a JSON-encoded string containing an object.

Attributes

Exceptions

if the parse fails or doesn't yield a JSONObject.

Remarks

Creates a new JSONObject with name/value mappings from the JSON string.

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

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

JSONObject(JSONObject, String[])

Creates a new JSONObject by copying mappings for the listed names from the given object.

[Android.Runtime.Register(".ctor", "(Lorg/json/JSONObject;[Ljava/lang/String;)V", "")]
public JSONObject (Org.Json.JSONObject copyFrom, string[] names);
[<Android.Runtime.Register(".ctor", "(Lorg/json/JSONObject;[Ljava/lang/String;)V", "")>]
new Org.Json.JSONObject : Org.Json.JSONObject * string[] -> Org.Json.JSONObject

Parameters

copyFrom
JSONObject
names
String[]
Attributes

Exceptions

Remarks

Creates a new JSONObject by copying mappings for the listed names from the given object. Names that aren't present in copyFrom will be skipped.

Java documentation for org.json.JSONObject.JSONObject(org.json.JSONObject, java.lang.String[]).

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

JSONObject(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected JSONObject (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Org.Json.JSONObject : nativeint * Android.Runtime.JniHandleOwnership -> Org.Json.JSONObject

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

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