Kanso transform CSV keeps spaces in key names

12 views
Skip to first unread message

Austin Gonyou

unread,
Nov 7, 2014, 11:53:16 AM11/7/14
to ka...@googlegroups.com
Hi Kanso folks!

I did some research with Kanso and other tools and I think kanso is awesome and super fast.
There's one thing I would ike some help with if anyone can assist.

Question: Is there a way to get Kanso to remove spaces from field names.
(My dilemma replace space with underscore for this example or upper case to lower case, please see below)


example CSV:

CSV Header: FIELD ONE, FIELD TWO
CSV Data: "value one", "value two"


json output with kanso:
[
   { 
  "FIELD ONE" : "value one",
  "FIELD TWO" : "value two"
   }
]

The JSON output loads into the DB fine but because of the spaces some keys are hard to access/use whereas,
    if I do csv2json.rb (ruby script) I get this, more desirable output:

[
   {
  "field_one": "value one",
  "field_two": "value two"
   }
]

This loads fine as well but there are less hoops to jump through regarding the keys.

Is there an option on the transform argument that can enforce this kind of behavior?

Kanso is really fast and I love it and ruby is slow, though I still love it since I'm more of a scripting guy.

If anyone has some feedback on the subject I'd really appreciate guidance or assistance to achieve space-less keys and replace with _

Thanks in advance.

Austin
Reply all
Reply to author
Forward
Message has been deleted
0 new messages