Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer and Boolean type keys #4

Open
ammuluk opened this issue Aug 21, 2018 · 3 comments
Open

Integer and Boolean type keys #4

ammuluk opened this issue Aug 21, 2018 · 3 comments

Comments

@ammuluk
Copy link

ammuluk commented Aug 21, 2018

Is there a way to specify the type of the key when converting to JSON? I have csv columns which are integers and boolean. When i use this module to convert csv to json, those values are outputted as strings.

{
"number": "240",
"isdown": "FALSE"
}
I am excepting
{
"number": 240,
"isdown": false
}

@rossw7
Copy link

rossw7 commented Dec 16, 2018

I would love this also..

@rossw7
Copy link

rossw7 commented Dec 18, 2018

I have made changes to deal with strings or integers. (probably could do the same for boolean, just not in my usecase/data)

'Severity': {'Product': 10, 'Normalized': 10},

@chamkank
Copy link
Owner

@ammuluk
Apologies for the late response! @rossw7 has opened #6 to deal with integer values.

Booleans will be a little bit tricky because there is no standard way to represent a boolean value in a CSV file (ex: true can be True, TRUE, true, yes, YES, Yes, etc), but it would be interesting to add some sort of option to let the user manually specify which values should be type converted (ex: {'bool': {False: ['No', 'no', ...], True: ['YES', 'yes', ...]} }).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants