parseToJSONObject

open fun parseToJSONObject(jsonString: String): JSONObject

Parses given string containing JSON data into a JSONObject which provides an interface for extracting JSON data. Note that this method only supports parsing JSON strings that are represented by a top-level object, i.e., starts with a curly brace. Top level arrays are not supported by this method (i.e., starts with square bracket).

Return

the parsed JSONObject

Parameters

jsonString

the JSON object data to be parsed (must not be null or empty)

Throws

org.json.JSONException

if there are any issues parsing the JSON