simonseo / nyuad-spammer

Subscribe to instant notifications from Student Portal. Don't miss Marvel movie tickets again!
13 stars 5 forks source link

Using json2csv programmatically #15

Closed simonseo closed 6 years ago

simonseo commented 6 years ago

I want to use json2csv programmatically within the flask server. How do I do this?

Ideally there will be a method that takes a 2 arguments: either of [json string/python dict/json filename/json file] and an output filename. It will save any of these to a CSV file of the given output filename.

Maybe we can just write a few lines of code that does this. I think the json2csv library is unnecessarily big for our usage.

anchor14 commented 6 years ago

I think we might need one more step for future usage which is creating an outline json file out of the json file that is given. I think this would help in two ways.

  1. It simply is needed. Converting json to a csv directly doesn't work.
  2. Even if the student portal decides to change the json format down the road, the outline creating mid-step would guarantee that our code keeps working.

I do agree that the json2csv library is way too big so we want to cut it down.