/** * Construct a JSONArray from a source JSON text.<p> * * @param source a string that begins with * <code>[</code> <small>(left bracket)</small> * and ends with <code>]</code> <small>(right bracket)</small> * @throws JSONException if there is a syntax error */ public JSONArray(String source) throws JSONException { this(new JSONTokener(source)); }
/** * Construct a JSONArray from a source JSON text.<p> * * @param source a string that begins with * <code>[</code> <small>(left bracket)</small> * and ends with <code>]</code> <small>(right bracket)</small> * @throws JSONException if there is a syntax error */ public JSONArray(String source) throws JSONException { this(new JSONTokener(source)); }
/** * Construct a JSONObject from a source JSON text string.<p> * * This is the most commonly used JSONObject constructor.<p> * * @param source a string beginning * with <code>{</code> <small>(left brace)</small> and ending * with <code>}</code> <small>(right brace)</small> * @exception JSONException if there is a syntax error in the source string */ public JSONObject(String source) throws JSONException { this(new JSONTokener(source)); }
/** * Construct a JSONObject from a source JSON text string, optionally sorted.<p> * * This is the most commonly used JSONObject constructor.<p> * * @param source a string beginning * @param sorted true for sorted, false for none sorted * with <code>{</code> <small>(left brace)</small> and ending * with <code>}</code> <small>(right brace)</small> * @exception JSONException if there is a syntax error in the source string */ public JSONObject(String source, boolean sorted) throws JSONException { this(new JSONTokener(source), sorted); }
/** * Produce a JSONArray of JSONObjects from a comma delimited text string, * using the first row as a source of names.<p> * * @param string The comma delimited text * @return A JSONArray of JSONObjects * @throws JSONException if something goes wrong */ public static JSONArray toJSONArray(String string) throws JSONException { return toJSONArray(new JSONTokener(string)); }
/** * Produce a JSONArray of JSONObjects from a comma delimited text string * using a supplied JSONArray as the source of element names.<p> * * @param names A JSONArray of strings. * @param string The comma delimited text * @return A JSONArray of JSONObjects * @throws JSONException if something goes wrong */ public static JSONArray toJSONArray(JSONArray names, String string) throws JSONException { return toJSONArray(names, new JSONTokener(string)); }
/** * Produce a JSONArray of JSONObjects from a comma delimited text string * using a supplied JSONArray as the source of element names.<p> * * @param names A JSONArray of strings. * @param string The comma delimited text * @return A JSONArray of JSONObjects * @throws JSONException if something goes wrong */ public static JSONArray toJSONArray(JSONArray names, String string) throws JSONException { return toJSONArray(names, new JSONTokener(string)); }
/** * Produce a JSONArray of JSONObjects from a comma delimited text string, * using the first row as a source of names.<p> * * @param string The comma delimited text * @return A JSONArray of JSONObjects * @throws JSONException if something goes wrong */ public static JSONArray toJSONArray(String string) throws JSONException { return toJSONArray(new JSONTokener(string)); }
JSONTokener tok = new JSONTokener(fileContent); tok.setOrdered(true); JSONObject root = new JSONObject(tok, true);