Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
P parabix-devel
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 9
    • Issues 9
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cameron
  • parabix-devel
  • Wiki
  • csv2json

csv2json · Changes

Page history
Update csv2json authored Nov 09, 2021 by cameron's avatar cameron
Hide whitespace changes
Inline Side-by-side
Showing with 17 additions and 3 deletions
+17 -3
  • csv2json.md csv2json.md +17 -3
  • No files found.
csv2json.md
View page @ b700694c
......@@ -2,13 +2,27 @@
## Introduction
As an example of Parabix methods, consider the task of converting CSV (Comma-Separated
Value) files to JSON format (JavaScript Object Notation).
The overall structure of CSV to JSON conversion has 3 phases.
1. Determination of the CSV to JSON translation scheme for the particular file to be converted.
This scheme identifies the number of fields in each record, the corresponding field names for
JSON attributes and any other parameters that govern the translation.
This scheme identifies the number of fields in each record, the corresponding field names for JSON attributes and any other parameters that govern the translation.
2. Parsing the CSV input to determine the records and fields.
3. Transforming the parsed input according to the scheme to produce JSON output.
## Simple Universal Translation Scheme
One possible translation scheme for CSV to JSON is straightforward and universally
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 (").
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.
## Example
As a simple running example, we use the following CSV input file.
......@@ -231,4 +245,4 @@ does the insertion of color escape sequences for matched strings.
StreamSet * ColorizedBytes = E->CreateStreamSet(1, 8);
E->CreateKernelCall<P2SKernel>(ColorizedBasis, ColorizedBytes);
```
```
\ No newline at end of file
Clone repository
  • Bracket Matching
  • CSV Validation
  • CSVediting
  • CSVparsing
  • Character Code Compilers
  • KernelLibrary
  • Pablo
  • ParabixTransform
  • Parallel Deletion
  • Parallel Hashing
  • Performance Testing Script
  • Shuffle Pattern Library
  • StaticCCC
  • String Insertion
  • UCD: Unicode Property Database and Compilers
View All Pages