CsvToMaps
See javadoc - uk.gov.gchq.koryphe.impl.function.CsvToMaps
Available since Koryphe version 1.8.0
Parses a CSV into Maps
Examples
Csv to map
Java
JSON
Full JSON
Python
final CsvToMaps function = new CsvToMaps().header("header1", "header2", "header3").firstRow(1);
{
"class" : "CsvToMaps",
"header" : [ "header1", "header2", "header3" ],
"firstRow" : 1
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.CsvToMaps",
"header" : [ "header1", "header2", "header3" ],
"firstRow" : 1
}
g.CsvToMaps(
header=[
"header1",
"header2",
"header3"
],
first_row=1
)
Input type:
java.lang.String
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.String | header1,header2,header3 value1,value2,value3 | uk.gov.gchq.koryphe.util.IterableUtil$MappedIterable | [{header3=value3, header2=value2, header1=value1}] |
java.lang.String | header1,header2,header3 value1,value2,value3 value4,value5,value6" | uk.gov.gchq.koryphe.util.IterableUtil$MappedIterable | [{header3=value3, header2=value2, header1=value1}, {header3=value6", header2=value5, header1=value4}] |
java.lang.String | header1,header2,header3 ,,value3 value4,value5,value6" | uk.gov.gchq.koryphe.util.IterableUtil$MappedIterable | [{header3=value3, header2=, header1=}, {header3=value6", header2=value5, header1=value4}] |
java.lang.String | header1,header2,header3,header4 value1,value2,value3,value4 value5,value6,value7,value8" | NoSuchElementException: null | |
null | null | ||
java.lang.String | uk.gov.gchq.koryphe.util.IterableUtil$MappedIterable | [] |