... | ... | @@ -18,11 +18,14 @@ applicable to produce a correct JSON format. |
|
|
1. Every CSV data record is translated into a JSON object with key-value pairs enclosed in "`{}`".
|
|
|
2. CSV headers become the keys for each key-value pair.
|
|
|
3. The data values in each column of each CSV record are translated into JSON strings enclosed in double quotes (`"`).
|
|
|
4. The generated JSON objects are stored in one large JSON array.
|
|
|
5. The JSON objects are displayed one per line, with no other whitespace added to the representation.
|
|
|
|
|
|
Although this scheme is universal, it could be preferable to translate some data values
|
|
|
into JSON numbers, booleans or the `null` value instead. However, we first consider
|
|
|
the universal scheme in order to illustrate the simplest application of Parabix methods
|
|
|
to this problem.
|
|
|
into JSON numbers, booleans (`true` and `false`) or the `null` value instead.
|
|
|
Other options involve different whitespace conventions for the JSON output and/or possibly
|
|
|
translating some CSV values into structured JSON objects.
|
|
|
However, we first consider the universal scheme in order to illustrate the simplest application of Parabix methods to this problem.
|
|
|
|
|
|
## Example
|
|
|
As a simple running example, we use the following CSV input file.
|
... | ... | |