-
-
Save atskimura/8bb4cabdfe2c966b755ddc89f3051457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%dw 2.0 | |
input payload csv | |
output application/json | |
var category = (age: Number) -> if (age < 30) "young" else "adult" | |
--- | |
payload map (row, rowIndex) -> { | |
name: row.name, | |
age: row.age as Number, | |
city: row.city, | |
category: category(row.age) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name | age | city | |
---|---|---|---|
John | 30 | New York | |
Jane | 25 | Los Angeles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "John", | |
"age": 30, | |
"city": "New York", | |
"category": "adult" | |
}, | |
{ | |
"name": "Jane", | |
"age": 25, | |
"city": "Los Angeles", | |
"category": "young" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment