evidens/json2csv

trouble creating outline for python api results

vtischuk opened this issue · 0 comments

testfile_outline.txt
Hi,

I am using python with the workfront api to return JSON objects (theoretically) like the sample below and am trying to create an outline from either the python results object of from a file that I wrote the results to but I haven't been able to sucessfully generate a results file.

Using this command 👍 python gen_outline.py --collection nodes C:\Python27\resultsj.txt -o C:\Python27\testfile_outlinej.json

produces this
Traceback (most recent call last):
File "gen_outline.py", line 85, in
main()
File "gen_outline.py", line 75, in main
outline = make_outline(args.json_file, args.each_line, args.collection)
File "gen_outline.py", line 50, in make_outline
key_map = gather_key_map(iterator)
File "gen_outline.py", line 31, in gather_key_map
for d in iterator:
File "gen_outline.py", line 26, in coll_iter
for obj in data[coll_key]:
KeyError: 'nodes'


Using this command produces that attached outline file, that when run with json2csv produces a file of headers and 'no data'.

python gen_outline.py --each-line C:\Python27\resultsj.txt -o C:\Python27\testfile_outline.json



Your suggestions would be appreciated. Thanks, Victor

sample json line:

[{u'status': u'CPL', u'name': u'H557 Nano Valve Operator', u'plannedStartDate': u'2014-04-01T08:00:00:000-0400', u'objCode': u'PROJ', u'priority': 0, u'percentComplete': 100.0, u'projectedCompletionDate': u'2015-06-01T07:42:38:615-0400', u'ID': u'52ceb3a1001da497df97a63c7e99d6c8', u'plannedCompletionDate': u'2015-06-01T17:00:00:000-0400'} ]