walkerline117
8 years agoContributor
Interesting question on changing Json key danamically
Here’s our use case.
We have 2 files
- XML: contains the meta data(e.g. column name, column order) information of the data file
- CSV: contains the actual data
Our goal:
Read the CSV file and change the column names(by default for CSV file, it will show field001, field002 etc… in Snaplogic as the key of each column) with the actual column name in the XML file.
For example, here is the xml file content:
<SchemaTable>
<ColumnName>ftl_type_id</ColumnName>
<ColumnOrdinal>0</ColumnOrdinal>
</SchemaTable>
<SchemaTable>
<ColumnName>ftl_title</ColumnName>
<ColumnOrdinal>1</ColumnOrdinal>
</SchemaTable>
Here is the csv file
1,Region
2,Country
Expect output:
{ftl_type_id:1, ftl_title:Region}
{ftl_type_id:2, ftl_title:Country}
Is there a way to do this in a single pipeline?
Thanks