-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix bug in csvToJson method. #94
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #94 +/- ##
=======================================
Coverage 62.99% 62.99%
=======================================
Files 1 1
Lines 254 254
=======================================
Hits 160 160
Misses 94 94
Continue to review full report at Codecov.
|
@@ -84,7 +84,7 @@ def csvToJson(self, csvData = None, fieldnamesList = None): | |||
if csvData: | |||
data = csv.DictReader( csvData, fieldnames = fieldnamesList) | |||
jsonData = json.dumps( [ row for row in data ] ) | |||
return out | |||
return jsonData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the code doesn't enter the csvData
if block, it ends up returning ''
which is not a valid json. if the JSON is what needs to be returned then ideally it should return {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then that should be applied to xmlToJson
method too.
This method not at all gives expected output json. Should I change the whole definition of this method?(which can generate right json data from csv)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely! Thanks for catching that. Feel free to make a change to that too. 😄
Fixes #93