Node Director
|
This provides static methods to convert comma delimited text into a JSONArray, and to covert a JSONArray into comma delimited text. More...
Static Public Member Functions | |
static JSONArray | rowToJSONArray (JSONTokener x) throws ParseException |
Produce a JSONArray of strings from a row of comma delimited values. | |
static JSONObject | rowToJSONObject (JSONArray names, JSONTokener x) throws ParseException |
Produce a JSONObject from a row of comma delimited text, using a parallel JSONArray of strings to provides the names of the elements. | |
static JSONArray | toJSONArray (String string) throws ParseException |
Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names. | |
static JSONArray | toJSONArray (JSONTokener x) throws ParseException |
Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names. | |
static JSONArray | toJSONArray (JSONArray names, String string) throws ParseException |
Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of element names. | |
static JSONArray | toJSONArray (JSONArray names, JSONTokener x) throws java.text.ParseException |
Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of element names. | |
static String | rowToString (JSONArray ja) |
Produce a comma delimited text row from a JSONArray. | |
static String | toString (JSONArray ja) |
Produce a comma delimited text from a JSONArray of JSONObjects. | |
static String | toString (JSONArray names, JSONArray ja) |
Produce a comma delimited text from a JSONArray of JSONObjects using a provided list of names. |
This provides static methods to convert comma delimited text into a JSONArray, and to covert a JSONArray into comma delimited text.
Comma delimited text is a very popular format for data interchange. It is understood by most database, spreadsheet, and organizer programs.
Each row of text represents a row in a table or a data record. Each row ends with a NEWLINE character. Each row contains one or more values. Values are separated by commas. A value can contain any character except for comma, unless is is wrapped in single quotes or double quotes.
The first row usually contains the names of the columns.
A comma delimited list can be converted into a JSONArray of JSONObjects. The names for the elements in the JSONObjects can be taken from the names in the first row.
|
static |
Produce a JSONArray of strings from a row of comma delimited values.
x | A JSONTokener of the source text. |
ParseException |
References org.json.JSONTokener.next(), org.json.JSONArray.put(), and org.json.JSONTokener.syntaxError().
Referenced by org.json.CDL.rowToJSONObject(), and org.json.CDL.toJSONArray().
|
static |
Produce a JSONObject from a row of comma delimited text, using a parallel JSONArray of strings to provides the names of the elements.
names | A JSONArray of names. This is commonly obtained from the first row of a comma delimited text file using the rowToJSONArray method. |
x | A JSONTokener of the source text. |
ParseException |
References org.json.CDL.rowToJSONArray(), and org.json.JSONArray.toJSONObject().
Referenced by org.json.CDL.toJSONArray().
|
static |
Produce a comma delimited text row from a JSONArray.
Values containing the comma character will be quoted.
ja | A JSONArray of strings. |
References org.json.JSONArray.length(), and org.json.JSONArray.opt().
Referenced by org.json.CDL.toString().
|
static |
Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names.
string | The comma delimited text. |
ParseException |
Referenced by org.json.Test.main(), and org.json.CDL.toJSONArray().
|
static |
Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names.
x | The JSONTokener containing the comma delimited text. |
ParseException |
References org.json.CDL.rowToJSONArray(), and org.json.CDL.toJSONArray().
|
static |
Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of element names.
names | A JSONArray of strings. |
string | The comma delimited text. |
ParseException |
References org.json.CDL.toJSONArray().
|
static |
Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of element names.
names | A JSONArray of strings. |
x | A JSONTokener of the source text. |
java.text.ParseException |
References org.json.JSONArray.length(), org.json.JSONArray.put(), and org.json.CDL.rowToJSONObject().
|
static |
Produce a comma delimited text from a JSONArray of JSONObjects.
The first row will be a list of names obtained by inspecting the first JSONObject.
ja | A JSONArray of JSONObjects. |
References org.json.JSONObject.names(), org.json.JSONArray.optJSONObject(), and org.json.CDL.rowToString().
Referenced by org.json.Test.main().
Produce a comma delimited text from a JSONArray of JSONObjects using a provided list of names.
The list of names is not included in the output.
References org.json.JSONArray.length(), org.json.JSONArray.optJSONObject(), org.json.CDL.rowToString(), org.json.JSONObject.toJSONArray(), and org.json.JSONObject.toString().