-
Notifications
You must be signed in to change notification settings - Fork 36
TSV to JSON
This document explains how to use tsvtojson in console.
After completion of installation go to the ettlib/etl/ directory. Write the following following command in console:
$ tsvtojson
tsvtojson:
Usage: tsvtojson [-v] [-t tsv file] [-j json file] [-o object type] [-c column headers txt file] [-u unique field]
Options:
-t tsv file, --tsv=file
`Parse the given TSV file and turn it into JSON.`
-j json file --json=file
`Output the named JSON file.`
-c column headers file --cols=file
`Use the provided column headers to parse the TSV and to name fields in the JSON.`
-o object type --object=type
`Wrap the list of objects for each row in the TSV file in the named JSON object type. `
-u unique field --unique=field
`Identifies a unique field per record in the TSV so that duplicate JSON files are not created.`
-v, --verbose
`Work verbosely rather than silently.`
It shows the default options available for usage. Now let's structure a sample input:
$ tsvtojson -t NameOfYourTsv -j NameOfYourOutputJson -c NameOfFileForColumnHeads -o NameofObjectType -u NameOfUniqueField
$ tsvtojson --tsv=NameOfYourTsv --json=NameOfYourOutputJson --cols=NameOfFileForColumnHeads --object NameofObjectType --unique=NameOfUniqueField
For ex:
$ tsvtojson --tsv=computrabajo.tsv -j somefile.json -c test.txt -o employment