CDL

open class CDL

This provides static methods to convert comma delimited text into a JSONArray, and to convert 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.

Author

JSON.org

Functions

Link copied to clipboard
Produce a JSONArray of strings from a row of comma delimited values.
Link copied to clipboard
Produce a JSONObject from a row of comma delimited text, using a parallel JSONArray of strings to provides the names of the elements.
Link copied to clipboard
Produce a comma delimited text row from a JSONArray.
Link copied to clipboard
open fun toJSONArray(string: String): JSONArray
Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names.
open fun toJSONArray(names: JSONArray, string: String): JSONArray
Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of element names.
Link copied to clipboard
open fun toString(ja: JSONArray): String
Produce a comma delimited text from a JSONArray of JSONObjects.
open fun toString(names: JSONArray, ja: JSONArray): String
Produce a comma delimited text from a JSONArray of JSONObjects using a provided list of names.