Skip to content

Commit 7aa77ba

Browse files
committed
update readme
1 parent 260424e commit 7aa77ba

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

readme.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,27 @@ csv({
630630

631631
Above example will convert `birthday` column into a js `Date` object.
632632

633+
the returned value will be used in result JSON object. returning `undefined` will not change result JSON object. You can do following:
634+
635+
```js
636+
/*csv data
637+
user.name, birthday
638+
Joe, 1970-01-01
639+
*/
640+
csv({
641+
colParser:{
642+
"user.name":function(item, head, resultRow, row , colIdx){
643+
resultRow[head]=item;
644+
}
645+
}
646+
})
647+
648+
```
649+
650+
without the parser the json is like {user:{name:Joe}}, with the parser the json is like {"user.name":Joe}
651+
652+
653+
633654
# Contribution
634655

635656
`csvtojson` follows github convention for contributions. Here are some steps:

0 commit comments

Comments
 (0)