Basic usage of Data Conv


NAME


Data Conv is used to convert a file format among JSON, XML, CSV.


SYNOPSYS


Data Conv needs next parameters or options.

Parameter


Operation

  • Supports CSV-to-TSV, CSV-to-_SV, JSON-to-XML, XML-to-JSON
  • csv2tsv: converts CSV to TSV (Tab-separated values) format
  • csv2_sv: converts CSV to a character separated values which you specify as 'Target separator'
  • json2xml / xml2json: converts JSON to XML format or vice versa

Source File

  • A source file to be converted

Target File

  • Target file to save the converted file

Options


Target separator

  • A single character to be used as separator

File Encoding

  • File encoding type of source file.
  • Default: utf8


In case of UTF8, the encoding of a source file must be UTF-8 without BOM (Byte Order Mark). Windows Notepad saves files as ANSI by default. Even though you select UTF-8 in Notepad, it saves as UTF-8 with BOM. It's a good idea to use the 3rd party editor that supports UTF-8 without BOM , such like Notepad++, Sublime Text.


Examples


EX1. CSV-to-TSV

Paramaters

Parameters\OptionsValues
Operationcsv2tsv
Source FileC:\1.MyUtils\TestRun\TestRun\csv_sample.csv
Target FileC:\1.MyUtils\TestRun\TestResult\csv2tsv.txt

Results

(1) source file

id,first_name,last_name,email
1,Jillene,Ashness,jashness0@cisco.com
2,Briney,Lightbourne,blightbourne1@slate.com
3,Letti,Cayzer,lcayzer2@utexas.edu
4,Abramo,Gerrelts,agerrelts3@people.com.cn
5,Kaitlynn,Sussex,ksussex4@wsj.com


(2) results

id	first_name	last_name	email
1	Jillene	Ashness	jashness0@cisco.com
2	Briney	Lightbourne	blightbourne1@slate.com
3	Letti	Cayzer	lcayzer2@utexas.edu
4	Abramo	Gerrelts	agerrelts3@people.com.cn
5	Kaitlynn	Sussex	ksussex4@wsj.com

EX2. CSV-to-_SV

Parameters

Parameters\OptionsValues
Operationcsv2_sv
Source FileC:\1.MyUtils\TestRun\TestRun\csv_sample.csv
Target FileC:\1.MyUtils\TestRun\TestResult\csv2_sv.txt
Target separator*

Results

(1) source file

id,first_name,last_name,email
1,Jillene,Ashness,jashness0@cisco.com
2,Briney,Lightbourne,blightbourne1@slate.com
3,Letti,Cayzer,lcayzer2@utexas.edu
4,Abramo,Gerrelts,agerrelts3@people.com.cn
5,Kaitlynn,Sussex,ksussex4@wsj.com


(2) results

id*first_name*last_name*email
1*Jillene*Ashness*jashness0@cisco.com
2*Briney*Lightbourne*blightbourne1@slate.com
3*Letti*Cayzer*lcayzer2@utexas.edu
4*Abramo*Gerrelts*agerrelts3@people.com.cn
5*Kaitlynn*Sussex*ksussex4@wsj.com



EX3. JSON-to-XML

Parameters

Parameters\OptionsValues
Operationjson2xml
Source FileC:\1.MyUtils\TestRun\TestRun\json_sample.csv
Target FileC:\1.MyUtils\TestRun\TestResult\results.xml

Results

(1) source file

{
    "glossary": {
        "title": "example glossary",
		"GlossDiv": {
            "title": "S",
			"GlossList": {
                "GlossEntry": {
                    "ID": "SGML",
					"SortAs": "SGML",
					"GlossTerm": "Standard Generalized Markup Language",
					"Acronym": "SGML",
					"Abbrev": "ISO 8879:1986",
					"GlossDef": {
                        "para": "A meta-markup language, used to create markup languages such as DocBook.",
						"GlossSeeAlso": ["GML", "XML"]
                    },
					"GlossSee": "markup"
                }
            }
        }
    }
}


(2) results

<?xml version="1.0" encoding="utf-8"?>
<glossary>
	<title>example glossary</title>
	<GlossDiv>
		<title>S</title>
		<GlossList>
			<GlossEntry>
				<ID>SGML</ID>
				<SortAs>SGML</SortAs>
				<GlossTerm>Standard Generalized Markup Language</GlossTerm>
				<Acronym>SGML</Acronym>
				<Abbrev>ISO 8879:1986</Abbrev>
				<GlossDef>
					<para>A meta-markup language, used to create markup languages such as DocBook.</para>
					<GlossSeeAlso>GML</GlossSeeAlso>
					<GlossSeeAlso>XML</GlossSeeAlso>
				</GlossDef>
				<GlossSee>markup</GlossSee>
			</GlossEntry>
		</GlossList>
	</GlossDiv>
</glossary>



EX4. XML-to-JSON

Paramaters

Parameters\OptionsValues
Operationxml2json
Source FileC:\1.MyUtils\TestRun\TestRun\xml_sample.csv
Target FileC:\1.MyUtils\TestRun\TestResult\results.json

Results

(1) source

<?xml version="1.0" encoding="utf-8"?>
<glossary>
	<title>example glossary</title>
	<GlossDiv>
		<title>S</title>
		<GlossList>
			<GlossEntry>
				<ID>SGML</ID>
				<SortAs>SGML</SortAs>
				<GlossTerm>Standard Generalized Markup Language</GlossTerm>
				<Acronym>SGML</Acronym>
				<Abbrev>ISO 8879:1986</Abbrev>
				<GlossDef>
					<para>A meta-markup language, used to create markup languages such as DocBook.</para>
					<GlossSeeAlso>GML</GlossSeeAlso>
					<GlossSeeAlso>XML</GlossSeeAlso>
				</GlossDef>
				<GlossSee>markup</GlossSee>
			</GlossEntry>
		</GlossList>
	</GlossDiv>
</glossary>


(2) results

{
    "glossary": {
        "title": "example glossary",
        "GlossDiv": {
            "title": "S",
            "GlossList": {
                "GlossEntry": {
                    "ID": "SGML",
                    "SortAs": "SGML",
                    "GlossTerm": "Standard Generalized Markup Language",
                    "Acronym": "SGML",
                    "Abbrev": "ISO 8879:1986",
                    "GlossDef": {
                        "para": "A meta-markup language, used to create markup languages such as DocBook.",
                        "GlossSeeAlso": [
                            "GML",
                            "XML"
                        ]
                    },
                    "GlossSee": "markup"
                }
            }
        }
    }
}

PLATFORM


Here is the supported platform for this plugin.

  • This plugin support Windows 10 and above.
  • This plugin support Linux (Ubuntu).
  • This plugin support Mac.


Version

  • 1.515.1506


Limitation


SEE ALSO


LICENSE