how to iterate through dictionary in json object and convert it into csv [on hold]
$begingroup$
I have json file which i want to convert into csv how can i do that.
json object contains:
{'accountId': '001603869857',
'jobName': 'test_Kobe',
'results': {'items': [{'alternatives': [{'confidence': '0.5657',
'content': 'From'}],
'end_time': '0.47',
'start_time': '0.14',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'weekend'}],
'end_time': '1.0',
'start_time': '0.47',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6518',
'content': 'All'}],
'end_time': '1.18',
'start_time': '1.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6515',
'content': 'Star'}],
'end_time': '1.35',
'start_time': '1.18',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'Game'}],
'end_time': '1.56',
'start_time': '1.35',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'is'}],
'end_time': '1.66',
'start_time': '1.56',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'over'}],
'end_time': '2.01',
'start_time': '1.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.9779',
'content': "It's"}],
'end_time': '3.12',
'start_time': '3.02',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9991',
'content': 'time'}],
'end_time': '3.29',
'start_time': '3.12',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'to'}],
'end_time': '3.35',
'start_time': '3.29',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'get'}],
'end_time': '3.48',
'start_time': '3.36',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'back'}],
'end_time': '3.66',
'start_time': '3.49',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'down'}],
'end_time': '3.84',
'start_time': '3.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.962',
'content': 'to'}],
'end_time': '3.9',
'start_time': '3.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9999',
'content': 'business'}],
'end_time': '4.35',
'start_time': '3.91',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.5921',
'content': 'You'}],
'end_time': '5.4',
'start_time': '5.34',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.8089',
'content': "can't"}],
'end_time': '5.61',
'start_time': '5.41',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9607',
'content': 'get'}],
'end_time': '5.7',
'start_time': '5.61',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.3548',
'content': 'that'}],
'end_time': '5.83',
'start_time': '5.71',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9811',
'content': 'championship'}],
'end_time': '6.41',
'start_time': '5.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.83',
'content': "It's"}],
'end_time': '7.01',
'start_time': '6.81',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9913',
'content': 'fun'}],
'end_time': '7.22',
'start_time': '7.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.7233',
'content': 'Weekend'}],
'end_time': '7.48',
'start_time': '7.22',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9995',
'content': 'memorable'}],
'end_time': '9.14',
'start_time': '8.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.9797',
'content': 'It'}],
'end_time': '9.7',
'start_time': '9.64',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': "couldn't"}],
'end_time': '10.35',
'start_time': '10.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'be'}],
'end_time': '10.5',
'start_time': '10.36',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'scripted'}],
'end_time': '11.29',
'start_time': '10.74',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'any'}],
'end_time': '11.68',
'start_time': '11.3',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'better'}],
'end_time': '12.03',
'start_time': '11.69',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.839',
'content': 'May'}],
'end_time': '13.26',
'start_time': '13.02',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.839',
'content': 'be'}],
'end_time': '13.39',
'start_time': '13.26',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'my'}],
'end_time': '13.55',
'start_time': '13.39',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'last'}],
'end_time': '13.91',
'start_time': '13.55',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9992',
'content': 'one'}],
'end_time': '14.1',
'start_time': '13.91',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.6381',
'content': 'If'}],
'end_time': '14.25',
'start_time': '14.1',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6308',
'content': 'this'}],
'end_time': '14.75',
'start_time': '14.28',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6306',
'content': "it'll"}],
'end_time': '15.39',
'start_time': '15.25',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'be'}],
'end_time': '15.52',
'start_time': '15.4',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9993',
'content': 'a'}],
'end_time': '15.59',
'start_time': '15.52',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'hell'}],
'end_time': '15.76',
'start_time': '15.59',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'of'}],
'end_time': '15.84',
'start_time': '15.76',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9966',
'content': 'a'}],
'end_time': '15.93',
'start_time': '15.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.988',
'content': 'DVD'}],
'end_time': '16.44',
'start_time': '15.94',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'}],
'speaker_labels': {'segments': [{'end_time': '2.01',
'items': [{'end_time': '0.47',
'speaker_label': 'spk_0',
'start_time': '0.14'},
{'end_time': '1.0',
'speaker_label': 'spk_0',
'start_time': '0.47'},
{'end_time': '1.18',
'speaker_label': 'spk_0',
'start_time': '1.01'},
{'end_time': '1.35',
'speaker_label': 'spk_0',
'start_time': '1.18'},
{'end_time': '1.56',
'speaker_label': 'spk_0',
'start_time': '1.35'},
{'end_time': '1.66',
'speaker_label': 'spk_0',
'start_time': '1.56'},
{'end_time': '2.01',
'speaker_label': 'spk_0',
'start_time': '1.66'}],
'speaker_label': 'spk_0',
'start_time': '0.14'},
{'end_time': '4.35',
'items': [{'end_time': '3.12',
'speaker_label': 'spk_0',
'start_time': '3.02'},
{'end_time': '3.29',
'speaker_label': 'spk_0',
'start_time': '3.12'},
{'end_time': '3.35',
'speaker_label': 'spk_0',
'start_time': '3.29'},
{'end_time': '3.48',
'speaker_label': 'spk_0',
'start_time': '3.36'},
{'end_time': '3.66',
'speaker_label': 'spk_0',
'start_time': '3.49'},
{'end_time': '3.84',
'speaker_label': 'spk_0',
'start_time': '3.66'},
{'end_time': '3.9',
'speaker_label': 'spk_0',
'start_time': '3.84'},
{'end_time': '4.35',
'speaker_label': 'spk_0',
'start_time': '3.91'}],
'speaker_label': 'spk_0',
'start_time': '3.02'},
{'end_time': '7.48',
'items': [{'end_time': '5.4',
'speaker_label': 'spk_0',
'start_time': '5.34'},
{'end_time': '5.61',
'speaker_label': 'spk_0',
'start_time': '5.41'},
{'end_time': '5.7',
'speaker_label': 'spk_0',
'start_time': '5.61'},
{'end_time': '5.83',
'speaker_label': 'spk_0',
'start_time': '5.71'},
{'end_time': '6.41',
'speaker_label': 'spk_0',
'start_time': '5.84'},
{'end_time': '7.01',
'speaker_label': 'spk_0',
'start_time': '6.81'},
{'end_time': '7.22',
'speaker_label': 'spk_0',
'start_time': '7.01'},
{'end_time': '7.48',
'speaker_label': 'spk_0',
'start_time': '7.22'}],
'speaker_label': 'spk_0',
'start_time': '5.34'},
{'end_time': '12.03',
'items': [{'end_time': '9.14',
'speaker_label': 'spk_1',
'start_time': '8.66'},
{'end_time': '9.7',
'speaker_label': 'spk_1',
'start_time': '9.64'},
{'end_time': '10.35',
'speaker_label': 'spk_1',
'start_time': '10.01'},
{'end_time': '10.5',
'speaker_label': 'spk_1',
'start_time': '10.36'},
{'end_time': '11.29',
'speaker_label': 'spk_1',
'start_time': '10.74'},
{'end_time': '11.68',
'speaker_label': 'spk_1',
'start_time': '11.3'},
{'end_time': '12.03',
'speaker_label': 'spk_1',
'start_time': '11.69'}],
'speaker_label': 'spk_1',
'start_time': '8.66'},
{'end_time': '16.44',
'items': [{'end_time': '13.26',
'speaker_label': 'spk_1',
'start_time': '13.02'},
{'end_time': '13.39',
'speaker_label': 'spk_1',
'start_time': '13.26'},
{'end_time': '13.55',
'speaker_label': 'spk_1',
'start_time': '13.39'},
{'end_time': '13.91',
'speaker_label': 'spk_1',
'start_time': '13.55'},
{'end_time': '14.1',
'speaker_label': 'spk_1',
'start_time': '13.91'},
{'end_time': '14.25',
'speaker_label': 'spk_1',
'start_time': '14.1'},
{'end_time': '14.75',
'speaker_label': 'spk_1',
'start_time': '14.28'},
{'end_time': '15.39',
'speaker_label': 'spk_1',
'start_time': '15.25'},
{'end_time': '15.52',
'speaker_label': 'spk_1',
'start_time': '15.4'},
{'end_time': '15.59',
'speaker_label': 'spk_1',
'start_time': '15.52'},
{'end_time': '15.76',
'speaker_label': 'spk_1',
'start_time': '15.59'},
{'end_time': '15.84',
'speaker_label': 'spk_1',
'start_time': '15.76'},
{'end_time': '15.93',
'speaker_label': 'spk_1',
'start_time': '15.84'},
{'end_time': '16.44',
'speaker_label': 'spk_1',
'start_time': '15.94'}],
'speaker_label': 'spk_1',
'start_time': '13.02'}],
'speakers': 2},
'transcripts': [{'transcript': 'From weekend All Star Game is '
"over. It's time to get back down "
"to business. You can't get that "
"championship. It's fun. Weekend "
"memorable. It couldn't be "
'scripted any better. May be my '
"last one. If this it'll be a hell "
'of a DVD.'}]},
'status': 'COMPLETED'}
[This is the expected result]
python csv json
New contributor
$endgroup$
put on hold as off-topic by Mark.F, Simon Larsson, tuomastik, Esmailian, Siong Thye Goh 16 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not appear to be about data science, within the scope defined in the help center." – Mark.F, Simon Larsson, tuomastik, Esmailian, Siong Thye Goh
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I have json file which i want to convert into csv how can i do that.
json object contains:
{'accountId': '001603869857',
'jobName': 'test_Kobe',
'results': {'items': [{'alternatives': [{'confidence': '0.5657',
'content': 'From'}],
'end_time': '0.47',
'start_time': '0.14',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'weekend'}],
'end_time': '1.0',
'start_time': '0.47',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6518',
'content': 'All'}],
'end_time': '1.18',
'start_time': '1.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6515',
'content': 'Star'}],
'end_time': '1.35',
'start_time': '1.18',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'Game'}],
'end_time': '1.56',
'start_time': '1.35',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'is'}],
'end_time': '1.66',
'start_time': '1.56',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'over'}],
'end_time': '2.01',
'start_time': '1.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.9779',
'content': "It's"}],
'end_time': '3.12',
'start_time': '3.02',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9991',
'content': 'time'}],
'end_time': '3.29',
'start_time': '3.12',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'to'}],
'end_time': '3.35',
'start_time': '3.29',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'get'}],
'end_time': '3.48',
'start_time': '3.36',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'back'}],
'end_time': '3.66',
'start_time': '3.49',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'down'}],
'end_time': '3.84',
'start_time': '3.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.962',
'content': 'to'}],
'end_time': '3.9',
'start_time': '3.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9999',
'content': 'business'}],
'end_time': '4.35',
'start_time': '3.91',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.5921',
'content': 'You'}],
'end_time': '5.4',
'start_time': '5.34',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.8089',
'content': "can't"}],
'end_time': '5.61',
'start_time': '5.41',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9607',
'content': 'get'}],
'end_time': '5.7',
'start_time': '5.61',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.3548',
'content': 'that'}],
'end_time': '5.83',
'start_time': '5.71',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9811',
'content': 'championship'}],
'end_time': '6.41',
'start_time': '5.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.83',
'content': "It's"}],
'end_time': '7.01',
'start_time': '6.81',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9913',
'content': 'fun'}],
'end_time': '7.22',
'start_time': '7.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.7233',
'content': 'Weekend'}],
'end_time': '7.48',
'start_time': '7.22',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9995',
'content': 'memorable'}],
'end_time': '9.14',
'start_time': '8.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.9797',
'content': 'It'}],
'end_time': '9.7',
'start_time': '9.64',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': "couldn't"}],
'end_time': '10.35',
'start_time': '10.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'be'}],
'end_time': '10.5',
'start_time': '10.36',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'scripted'}],
'end_time': '11.29',
'start_time': '10.74',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'any'}],
'end_time': '11.68',
'start_time': '11.3',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'better'}],
'end_time': '12.03',
'start_time': '11.69',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.839',
'content': 'May'}],
'end_time': '13.26',
'start_time': '13.02',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.839',
'content': 'be'}],
'end_time': '13.39',
'start_time': '13.26',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'my'}],
'end_time': '13.55',
'start_time': '13.39',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'last'}],
'end_time': '13.91',
'start_time': '13.55',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9992',
'content': 'one'}],
'end_time': '14.1',
'start_time': '13.91',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.6381',
'content': 'If'}],
'end_time': '14.25',
'start_time': '14.1',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6308',
'content': 'this'}],
'end_time': '14.75',
'start_time': '14.28',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6306',
'content': "it'll"}],
'end_time': '15.39',
'start_time': '15.25',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'be'}],
'end_time': '15.52',
'start_time': '15.4',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9993',
'content': 'a'}],
'end_time': '15.59',
'start_time': '15.52',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'hell'}],
'end_time': '15.76',
'start_time': '15.59',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'of'}],
'end_time': '15.84',
'start_time': '15.76',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9966',
'content': 'a'}],
'end_time': '15.93',
'start_time': '15.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.988',
'content': 'DVD'}],
'end_time': '16.44',
'start_time': '15.94',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'}],
'speaker_labels': {'segments': [{'end_time': '2.01',
'items': [{'end_time': '0.47',
'speaker_label': 'spk_0',
'start_time': '0.14'},
{'end_time': '1.0',
'speaker_label': 'spk_0',
'start_time': '0.47'},
{'end_time': '1.18',
'speaker_label': 'spk_0',
'start_time': '1.01'},
{'end_time': '1.35',
'speaker_label': 'spk_0',
'start_time': '1.18'},
{'end_time': '1.56',
'speaker_label': 'spk_0',
'start_time': '1.35'},
{'end_time': '1.66',
'speaker_label': 'spk_0',
'start_time': '1.56'},
{'end_time': '2.01',
'speaker_label': 'spk_0',
'start_time': '1.66'}],
'speaker_label': 'spk_0',
'start_time': '0.14'},
{'end_time': '4.35',
'items': [{'end_time': '3.12',
'speaker_label': 'spk_0',
'start_time': '3.02'},
{'end_time': '3.29',
'speaker_label': 'spk_0',
'start_time': '3.12'},
{'end_time': '3.35',
'speaker_label': 'spk_0',
'start_time': '3.29'},
{'end_time': '3.48',
'speaker_label': 'spk_0',
'start_time': '3.36'},
{'end_time': '3.66',
'speaker_label': 'spk_0',
'start_time': '3.49'},
{'end_time': '3.84',
'speaker_label': 'spk_0',
'start_time': '3.66'},
{'end_time': '3.9',
'speaker_label': 'spk_0',
'start_time': '3.84'},
{'end_time': '4.35',
'speaker_label': 'spk_0',
'start_time': '3.91'}],
'speaker_label': 'spk_0',
'start_time': '3.02'},
{'end_time': '7.48',
'items': [{'end_time': '5.4',
'speaker_label': 'spk_0',
'start_time': '5.34'},
{'end_time': '5.61',
'speaker_label': 'spk_0',
'start_time': '5.41'},
{'end_time': '5.7',
'speaker_label': 'spk_0',
'start_time': '5.61'},
{'end_time': '5.83',
'speaker_label': 'spk_0',
'start_time': '5.71'},
{'end_time': '6.41',
'speaker_label': 'spk_0',
'start_time': '5.84'},
{'end_time': '7.01',
'speaker_label': 'spk_0',
'start_time': '6.81'},
{'end_time': '7.22',
'speaker_label': 'spk_0',
'start_time': '7.01'},
{'end_time': '7.48',
'speaker_label': 'spk_0',
'start_time': '7.22'}],
'speaker_label': 'spk_0',
'start_time': '5.34'},
{'end_time': '12.03',
'items': [{'end_time': '9.14',
'speaker_label': 'spk_1',
'start_time': '8.66'},
{'end_time': '9.7',
'speaker_label': 'spk_1',
'start_time': '9.64'},
{'end_time': '10.35',
'speaker_label': 'spk_1',
'start_time': '10.01'},
{'end_time': '10.5',
'speaker_label': 'spk_1',
'start_time': '10.36'},
{'end_time': '11.29',
'speaker_label': 'spk_1',
'start_time': '10.74'},
{'end_time': '11.68',
'speaker_label': 'spk_1',
'start_time': '11.3'},
{'end_time': '12.03',
'speaker_label': 'spk_1',
'start_time': '11.69'}],
'speaker_label': 'spk_1',
'start_time': '8.66'},
{'end_time': '16.44',
'items': [{'end_time': '13.26',
'speaker_label': 'spk_1',
'start_time': '13.02'},
{'end_time': '13.39',
'speaker_label': 'spk_1',
'start_time': '13.26'},
{'end_time': '13.55',
'speaker_label': 'spk_1',
'start_time': '13.39'},
{'end_time': '13.91',
'speaker_label': 'spk_1',
'start_time': '13.55'},
{'end_time': '14.1',
'speaker_label': 'spk_1',
'start_time': '13.91'},
{'end_time': '14.25',
'speaker_label': 'spk_1',
'start_time': '14.1'},
{'end_time': '14.75',
'speaker_label': 'spk_1',
'start_time': '14.28'},
{'end_time': '15.39',
'speaker_label': 'spk_1',
'start_time': '15.25'},
{'end_time': '15.52',
'speaker_label': 'spk_1',
'start_time': '15.4'},
{'end_time': '15.59',
'speaker_label': 'spk_1',
'start_time': '15.52'},
{'end_time': '15.76',
'speaker_label': 'spk_1',
'start_time': '15.59'},
{'end_time': '15.84',
'speaker_label': 'spk_1',
'start_time': '15.76'},
{'end_time': '15.93',
'speaker_label': 'spk_1',
'start_time': '15.84'},
{'end_time': '16.44',
'speaker_label': 'spk_1',
'start_time': '15.94'}],
'speaker_label': 'spk_1',
'start_time': '13.02'}],
'speakers': 2},
'transcripts': [{'transcript': 'From weekend All Star Game is '
"over. It's time to get back down "
"to business. You can't get that "
"championship. It's fun. Weekend "
"memorable. It couldn't be "
'scripted any better. May be my '
"last one. If this it'll be a hell "
'of a DVD.'}]},
'status': 'COMPLETED'}
[This is the expected result]
python csv json
New contributor
$endgroup$
put on hold as off-topic by Mark.F, Simon Larsson, tuomastik, Esmailian, Siong Thye Goh 16 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not appear to be about data science, within the scope defined in the help center." – Mark.F, Simon Larsson, tuomastik, Esmailian, Siong Thye Goh
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
I think your JSON example is not valid JSON. Could you provide the valid JSON code?
$endgroup$
– MachineLearner
18 hours ago
1
$begingroup$
It's better to ask this question at stackoverflow.com your question is just a programming problem rather than data science
$endgroup$
– Alireza Zolanvari
18 hours ago
add a comment |
$begingroup$
I have json file which i want to convert into csv how can i do that.
json object contains:
{'accountId': '001603869857',
'jobName': 'test_Kobe',
'results': {'items': [{'alternatives': [{'confidence': '0.5657',
'content': 'From'}],
'end_time': '0.47',
'start_time': '0.14',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'weekend'}],
'end_time': '1.0',
'start_time': '0.47',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6518',
'content': 'All'}],
'end_time': '1.18',
'start_time': '1.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6515',
'content': 'Star'}],
'end_time': '1.35',
'start_time': '1.18',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'Game'}],
'end_time': '1.56',
'start_time': '1.35',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'is'}],
'end_time': '1.66',
'start_time': '1.56',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'over'}],
'end_time': '2.01',
'start_time': '1.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.9779',
'content': "It's"}],
'end_time': '3.12',
'start_time': '3.02',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9991',
'content': 'time'}],
'end_time': '3.29',
'start_time': '3.12',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'to'}],
'end_time': '3.35',
'start_time': '3.29',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'get'}],
'end_time': '3.48',
'start_time': '3.36',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'back'}],
'end_time': '3.66',
'start_time': '3.49',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'down'}],
'end_time': '3.84',
'start_time': '3.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.962',
'content': 'to'}],
'end_time': '3.9',
'start_time': '3.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9999',
'content': 'business'}],
'end_time': '4.35',
'start_time': '3.91',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.5921',
'content': 'You'}],
'end_time': '5.4',
'start_time': '5.34',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.8089',
'content': "can't"}],
'end_time': '5.61',
'start_time': '5.41',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9607',
'content': 'get'}],
'end_time': '5.7',
'start_time': '5.61',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.3548',
'content': 'that'}],
'end_time': '5.83',
'start_time': '5.71',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9811',
'content': 'championship'}],
'end_time': '6.41',
'start_time': '5.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.83',
'content': "It's"}],
'end_time': '7.01',
'start_time': '6.81',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9913',
'content': 'fun'}],
'end_time': '7.22',
'start_time': '7.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.7233',
'content': 'Weekend'}],
'end_time': '7.48',
'start_time': '7.22',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9995',
'content': 'memorable'}],
'end_time': '9.14',
'start_time': '8.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.9797',
'content': 'It'}],
'end_time': '9.7',
'start_time': '9.64',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': "couldn't"}],
'end_time': '10.35',
'start_time': '10.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'be'}],
'end_time': '10.5',
'start_time': '10.36',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'scripted'}],
'end_time': '11.29',
'start_time': '10.74',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'any'}],
'end_time': '11.68',
'start_time': '11.3',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'better'}],
'end_time': '12.03',
'start_time': '11.69',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.839',
'content': 'May'}],
'end_time': '13.26',
'start_time': '13.02',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.839',
'content': 'be'}],
'end_time': '13.39',
'start_time': '13.26',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'my'}],
'end_time': '13.55',
'start_time': '13.39',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'last'}],
'end_time': '13.91',
'start_time': '13.55',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9992',
'content': 'one'}],
'end_time': '14.1',
'start_time': '13.91',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.6381',
'content': 'If'}],
'end_time': '14.25',
'start_time': '14.1',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6308',
'content': 'this'}],
'end_time': '14.75',
'start_time': '14.28',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6306',
'content': "it'll"}],
'end_time': '15.39',
'start_time': '15.25',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'be'}],
'end_time': '15.52',
'start_time': '15.4',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9993',
'content': 'a'}],
'end_time': '15.59',
'start_time': '15.52',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'hell'}],
'end_time': '15.76',
'start_time': '15.59',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'of'}],
'end_time': '15.84',
'start_time': '15.76',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9966',
'content': 'a'}],
'end_time': '15.93',
'start_time': '15.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.988',
'content': 'DVD'}],
'end_time': '16.44',
'start_time': '15.94',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'}],
'speaker_labels': {'segments': [{'end_time': '2.01',
'items': [{'end_time': '0.47',
'speaker_label': 'spk_0',
'start_time': '0.14'},
{'end_time': '1.0',
'speaker_label': 'spk_0',
'start_time': '0.47'},
{'end_time': '1.18',
'speaker_label': 'spk_0',
'start_time': '1.01'},
{'end_time': '1.35',
'speaker_label': 'spk_0',
'start_time': '1.18'},
{'end_time': '1.56',
'speaker_label': 'spk_0',
'start_time': '1.35'},
{'end_time': '1.66',
'speaker_label': 'spk_0',
'start_time': '1.56'},
{'end_time': '2.01',
'speaker_label': 'spk_0',
'start_time': '1.66'}],
'speaker_label': 'spk_0',
'start_time': '0.14'},
{'end_time': '4.35',
'items': [{'end_time': '3.12',
'speaker_label': 'spk_0',
'start_time': '3.02'},
{'end_time': '3.29',
'speaker_label': 'spk_0',
'start_time': '3.12'},
{'end_time': '3.35',
'speaker_label': 'spk_0',
'start_time': '3.29'},
{'end_time': '3.48',
'speaker_label': 'spk_0',
'start_time': '3.36'},
{'end_time': '3.66',
'speaker_label': 'spk_0',
'start_time': '3.49'},
{'end_time': '3.84',
'speaker_label': 'spk_0',
'start_time': '3.66'},
{'end_time': '3.9',
'speaker_label': 'spk_0',
'start_time': '3.84'},
{'end_time': '4.35',
'speaker_label': 'spk_0',
'start_time': '3.91'}],
'speaker_label': 'spk_0',
'start_time': '3.02'},
{'end_time': '7.48',
'items': [{'end_time': '5.4',
'speaker_label': 'spk_0',
'start_time': '5.34'},
{'end_time': '5.61',
'speaker_label': 'spk_0',
'start_time': '5.41'},
{'end_time': '5.7',
'speaker_label': 'spk_0',
'start_time': '5.61'},
{'end_time': '5.83',
'speaker_label': 'spk_0',
'start_time': '5.71'},
{'end_time': '6.41',
'speaker_label': 'spk_0',
'start_time': '5.84'},
{'end_time': '7.01',
'speaker_label': 'spk_0',
'start_time': '6.81'},
{'end_time': '7.22',
'speaker_label': 'spk_0',
'start_time': '7.01'},
{'end_time': '7.48',
'speaker_label': 'spk_0',
'start_time': '7.22'}],
'speaker_label': 'spk_0',
'start_time': '5.34'},
{'end_time': '12.03',
'items': [{'end_time': '9.14',
'speaker_label': 'spk_1',
'start_time': '8.66'},
{'end_time': '9.7',
'speaker_label': 'spk_1',
'start_time': '9.64'},
{'end_time': '10.35',
'speaker_label': 'spk_1',
'start_time': '10.01'},
{'end_time': '10.5',
'speaker_label': 'spk_1',
'start_time': '10.36'},
{'end_time': '11.29',
'speaker_label': 'spk_1',
'start_time': '10.74'},
{'end_time': '11.68',
'speaker_label': 'spk_1',
'start_time': '11.3'},
{'end_time': '12.03',
'speaker_label': 'spk_1',
'start_time': '11.69'}],
'speaker_label': 'spk_1',
'start_time': '8.66'},
{'end_time': '16.44',
'items': [{'end_time': '13.26',
'speaker_label': 'spk_1',
'start_time': '13.02'},
{'end_time': '13.39',
'speaker_label': 'spk_1',
'start_time': '13.26'},
{'end_time': '13.55',
'speaker_label': 'spk_1',
'start_time': '13.39'},
{'end_time': '13.91',
'speaker_label': 'spk_1',
'start_time': '13.55'},
{'end_time': '14.1',
'speaker_label': 'spk_1',
'start_time': '13.91'},
{'end_time': '14.25',
'speaker_label': 'spk_1',
'start_time': '14.1'},
{'end_time': '14.75',
'speaker_label': 'spk_1',
'start_time': '14.28'},
{'end_time': '15.39',
'speaker_label': 'spk_1',
'start_time': '15.25'},
{'end_time': '15.52',
'speaker_label': 'spk_1',
'start_time': '15.4'},
{'end_time': '15.59',
'speaker_label': 'spk_1',
'start_time': '15.52'},
{'end_time': '15.76',
'speaker_label': 'spk_1',
'start_time': '15.59'},
{'end_time': '15.84',
'speaker_label': 'spk_1',
'start_time': '15.76'},
{'end_time': '15.93',
'speaker_label': 'spk_1',
'start_time': '15.84'},
{'end_time': '16.44',
'speaker_label': 'spk_1',
'start_time': '15.94'}],
'speaker_label': 'spk_1',
'start_time': '13.02'}],
'speakers': 2},
'transcripts': [{'transcript': 'From weekend All Star Game is '
"over. It's time to get back down "
"to business. You can't get that "
"championship. It's fun. Weekend "
"memorable. It couldn't be "
'scripted any better. May be my '
"last one. If this it'll be a hell "
'of a DVD.'}]},
'status': 'COMPLETED'}
[This is the expected result]
python csv json
New contributor
$endgroup$
I have json file which i want to convert into csv how can i do that.
json object contains:
{'accountId': '001603869857',
'jobName': 'test_Kobe',
'results': {'items': [{'alternatives': [{'confidence': '0.5657',
'content': 'From'}],
'end_time': '0.47',
'start_time': '0.14',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'weekend'}],
'end_time': '1.0',
'start_time': '0.47',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6518',
'content': 'All'}],
'end_time': '1.18',
'start_time': '1.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6515',
'content': 'Star'}],
'end_time': '1.35',
'start_time': '1.18',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'Game'}],
'end_time': '1.56',
'start_time': '1.35',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'is'}],
'end_time': '1.66',
'start_time': '1.56',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'over'}],
'end_time': '2.01',
'start_time': '1.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.9779',
'content': "It's"}],
'end_time': '3.12',
'start_time': '3.02',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9991',
'content': 'time'}],
'end_time': '3.29',
'start_time': '3.12',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'to'}],
'end_time': '3.35',
'start_time': '3.29',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'get'}],
'end_time': '3.48',
'start_time': '3.36',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'back'}],
'end_time': '3.66',
'start_time': '3.49',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'down'}],
'end_time': '3.84',
'start_time': '3.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.962',
'content': 'to'}],
'end_time': '3.9',
'start_time': '3.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9999',
'content': 'business'}],
'end_time': '4.35',
'start_time': '3.91',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.5921',
'content': 'You'}],
'end_time': '5.4',
'start_time': '5.34',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.8089',
'content': "can't"}],
'end_time': '5.61',
'start_time': '5.41',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9607',
'content': 'get'}],
'end_time': '5.7',
'start_time': '5.61',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.3548',
'content': 'that'}],
'end_time': '5.83',
'start_time': '5.71',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9811',
'content': 'championship'}],
'end_time': '6.41',
'start_time': '5.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.83',
'content': "It's"}],
'end_time': '7.01',
'start_time': '6.81',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9913',
'content': 'fun'}],
'end_time': '7.22',
'start_time': '7.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.7233',
'content': 'Weekend'}],
'end_time': '7.48',
'start_time': '7.22',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9995',
'content': 'memorable'}],
'end_time': '9.14',
'start_time': '8.66',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.9797',
'content': 'It'}],
'end_time': '9.7',
'start_time': '9.64',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': "couldn't"}],
'end_time': '10.35',
'start_time': '10.01',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'be'}],
'end_time': '10.5',
'start_time': '10.36',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'scripted'}],
'end_time': '11.29',
'start_time': '10.74',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'any'}],
'end_time': '11.68',
'start_time': '11.3',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'better'}],
'end_time': '12.03',
'start_time': '11.69',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.839',
'content': 'May'}],
'end_time': '13.26',
'start_time': '13.02',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.839',
'content': 'be'}],
'end_time': '13.39',
'start_time': '13.26',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'my'}],
'end_time': '13.55',
'start_time': '13.39',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'last'}],
'end_time': '13.91',
'start_time': '13.55',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9992',
'content': 'one'}],
'end_time': '14.1',
'start_time': '13.91',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'},
{'alternatives': [{'confidence': '0.6381',
'content': 'If'}],
'end_time': '14.25',
'start_time': '14.1',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6308',
'content': 'this'}],
'end_time': '14.75',
'start_time': '14.28',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.6306',
'content': "it'll"}],
'end_time': '15.39',
'start_time': '15.25',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'be'}],
'end_time': '15.52',
'start_time': '15.4',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9993',
'content': 'a'}],
'end_time': '15.59',
'start_time': '15.52',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'hell'}],
'end_time': '15.76',
'start_time': '15.59',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '1.0',
'content': 'of'}],
'end_time': '15.84',
'start_time': '15.76',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.9966',
'content': 'a'}],
'end_time': '15.93',
'start_time': '15.84',
'type': 'pronunciation'},
{'alternatives': [{'confidence': '0.988',
'content': 'DVD'}],
'end_time': '16.44',
'start_time': '15.94',
'type': 'pronunciation'},
{'alternatives': [{'confidence': None, 'content': '.'}],
'type': 'punctuation'}],
'speaker_labels': {'segments': [{'end_time': '2.01',
'items': [{'end_time': '0.47',
'speaker_label': 'spk_0',
'start_time': '0.14'},
{'end_time': '1.0',
'speaker_label': 'spk_0',
'start_time': '0.47'},
{'end_time': '1.18',
'speaker_label': 'spk_0',
'start_time': '1.01'},
{'end_time': '1.35',
'speaker_label': 'spk_0',
'start_time': '1.18'},
{'end_time': '1.56',
'speaker_label': 'spk_0',
'start_time': '1.35'},
{'end_time': '1.66',
'speaker_label': 'spk_0',
'start_time': '1.56'},
{'end_time': '2.01',
'speaker_label': 'spk_0',
'start_time': '1.66'}],
'speaker_label': 'spk_0',
'start_time': '0.14'},
{'end_time': '4.35',
'items': [{'end_time': '3.12',
'speaker_label': 'spk_0',
'start_time': '3.02'},
{'end_time': '3.29',
'speaker_label': 'spk_0',
'start_time': '3.12'},
{'end_time': '3.35',
'speaker_label': 'spk_0',
'start_time': '3.29'},
{'end_time': '3.48',
'speaker_label': 'spk_0',
'start_time': '3.36'},
{'end_time': '3.66',
'speaker_label': 'spk_0',
'start_time': '3.49'},
{'end_time': '3.84',
'speaker_label': 'spk_0',
'start_time': '3.66'},
{'end_time': '3.9',
'speaker_label': 'spk_0',
'start_time': '3.84'},
{'end_time': '4.35',
'speaker_label': 'spk_0',
'start_time': '3.91'}],
'speaker_label': 'spk_0',
'start_time': '3.02'},
{'end_time': '7.48',
'items': [{'end_time': '5.4',
'speaker_label': 'spk_0',
'start_time': '5.34'},
{'end_time': '5.61',
'speaker_label': 'spk_0',
'start_time': '5.41'},
{'end_time': '5.7',
'speaker_label': 'spk_0',
'start_time': '5.61'},
{'end_time': '5.83',
'speaker_label': 'spk_0',
'start_time': '5.71'},
{'end_time': '6.41',
'speaker_label': 'spk_0',
'start_time': '5.84'},
{'end_time': '7.01',
'speaker_label': 'spk_0',
'start_time': '6.81'},
{'end_time': '7.22',
'speaker_label': 'spk_0',
'start_time': '7.01'},
{'end_time': '7.48',
'speaker_label': 'spk_0',
'start_time': '7.22'}],
'speaker_label': 'spk_0',
'start_time': '5.34'},
{'end_time': '12.03',
'items': [{'end_time': '9.14',
'speaker_label': 'spk_1',
'start_time': '8.66'},
{'end_time': '9.7',
'speaker_label': 'spk_1',
'start_time': '9.64'},
{'end_time': '10.35',
'speaker_label': 'spk_1',
'start_time': '10.01'},
{'end_time': '10.5',
'speaker_label': 'spk_1',
'start_time': '10.36'},
{'end_time': '11.29',
'speaker_label': 'spk_1',
'start_time': '10.74'},
{'end_time': '11.68',
'speaker_label': 'spk_1',
'start_time': '11.3'},
{'end_time': '12.03',
'speaker_label': 'spk_1',
'start_time': '11.69'}],
'speaker_label': 'spk_1',
'start_time': '8.66'},
{'end_time': '16.44',
'items': [{'end_time': '13.26',
'speaker_label': 'spk_1',
'start_time': '13.02'},
{'end_time': '13.39',
'speaker_label': 'spk_1',
'start_time': '13.26'},
{'end_time': '13.55',
'speaker_label': 'spk_1',
'start_time': '13.39'},
{'end_time': '13.91',
'speaker_label': 'spk_1',
'start_time': '13.55'},
{'end_time': '14.1',
'speaker_label': 'spk_1',
'start_time': '13.91'},
{'end_time': '14.25',
'speaker_label': 'spk_1',
'start_time': '14.1'},
{'end_time': '14.75',
'speaker_label': 'spk_1',
'start_time': '14.28'},
{'end_time': '15.39',
'speaker_label': 'spk_1',
'start_time': '15.25'},
{'end_time': '15.52',
'speaker_label': 'spk_1',
'start_time': '15.4'},
{'end_time': '15.59',
'speaker_label': 'spk_1',
'start_time': '15.52'},
{'end_time': '15.76',
'speaker_label': 'spk_1',
'start_time': '15.59'},
{'end_time': '15.84',
'speaker_label': 'spk_1',
'start_time': '15.76'},
{'end_time': '15.93',
'speaker_label': 'spk_1',
'start_time': '15.84'},
{'end_time': '16.44',
'speaker_label': 'spk_1',
'start_time': '15.94'}],
'speaker_label': 'spk_1',
'start_time': '13.02'}],
'speakers': 2},
'transcripts': [{'transcript': 'From weekend All Star Game is '
"over. It's time to get back down "
"to business. You can't get that "
"championship. It's fun. Weekend "
"memorable. It couldn't be "
'scripted any better. May be my '
"last one. If this it'll be a hell "
'of a DVD.'}]},
'status': 'COMPLETED'}
[This is the expected result]
python csv json
python csv json
New contributor
New contributor
edited 16 hours ago
Simon Larsson
51510
51510
New contributor
asked 23 hours ago
NikhilNikhil
11
11
New contributor
New contributor
put on hold as off-topic by Mark.F, Simon Larsson, tuomastik, Esmailian, Siong Thye Goh 16 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not appear to be about data science, within the scope defined in the help center." – Mark.F, Simon Larsson, tuomastik, Esmailian, Siong Thye Goh
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Mark.F, Simon Larsson, tuomastik, Esmailian, Siong Thye Goh 16 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not appear to be about data science, within the scope defined in the help center." – Mark.F, Simon Larsson, tuomastik, Esmailian, Siong Thye Goh
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
I think your JSON example is not valid JSON. Could you provide the valid JSON code?
$endgroup$
– MachineLearner
18 hours ago
1
$begingroup$
It's better to ask this question at stackoverflow.com your question is just a programming problem rather than data science
$endgroup$
– Alireza Zolanvari
18 hours ago
add a comment |
$begingroup$
I think your JSON example is not valid JSON. Could you provide the valid JSON code?
$endgroup$
– MachineLearner
18 hours ago
1
$begingroup$
It's better to ask this question at stackoverflow.com your question is just a programming problem rather than data science
$endgroup$
– Alireza Zolanvari
18 hours ago
$begingroup$
I think your JSON example is not valid JSON. Could you provide the valid JSON code?
$endgroup$
– MachineLearner
18 hours ago
$begingroup$
I think your JSON example is not valid JSON. Could you provide the valid JSON code?
$endgroup$
– MachineLearner
18 hours ago
1
1
$begingroup$
It's better to ask this question at stackoverflow.com your question is just a programming problem rather than data science
$endgroup$
– Alireza Zolanvari
18 hours ago
$begingroup$
It's better to ask this question at stackoverflow.com your question is just a programming problem rather than data science
$endgroup$
– Alireza Zolanvari
18 hours ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
These are high level steps :
- Transform data to "dictionary of lists". Each list in this dict represents a column in CSV. key of the dict is column label .
- Create a dataframe from this dict
- Save dataframe to CSV
Step 2 :
Documentation : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.from_dict.html
Code Examples : https://pbpython.com/pandas-list-dict.html, https://stackoverflow.com/questions/18837262/convert-python-dict-into-a-dataframe
Step 3 :
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html , https://chrisalbon.com/python/data_wrangling/pandas_saving_dataframe_as_csv/
$endgroup$
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
These are high level steps :
- Transform data to "dictionary of lists". Each list in this dict represents a column in CSV. key of the dict is column label .
- Create a dataframe from this dict
- Save dataframe to CSV
Step 2 :
Documentation : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.from_dict.html
Code Examples : https://pbpython.com/pandas-list-dict.html, https://stackoverflow.com/questions/18837262/convert-python-dict-into-a-dataframe
Step 3 :
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html , https://chrisalbon.com/python/data_wrangling/pandas_saving_dataframe_as_csv/
$endgroup$
add a comment |
$begingroup$
These are high level steps :
- Transform data to "dictionary of lists". Each list in this dict represents a column in CSV. key of the dict is column label .
- Create a dataframe from this dict
- Save dataframe to CSV
Step 2 :
Documentation : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.from_dict.html
Code Examples : https://pbpython.com/pandas-list-dict.html, https://stackoverflow.com/questions/18837262/convert-python-dict-into-a-dataframe
Step 3 :
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html , https://chrisalbon.com/python/data_wrangling/pandas_saving_dataframe_as_csv/
$endgroup$
add a comment |
$begingroup$
These are high level steps :
- Transform data to "dictionary of lists". Each list in this dict represents a column in CSV. key of the dict is column label .
- Create a dataframe from this dict
- Save dataframe to CSV
Step 2 :
Documentation : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.from_dict.html
Code Examples : https://pbpython.com/pandas-list-dict.html, https://stackoverflow.com/questions/18837262/convert-python-dict-into-a-dataframe
Step 3 :
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html , https://chrisalbon.com/python/data_wrangling/pandas_saving_dataframe_as_csv/
$endgroup$
These are high level steps :
- Transform data to "dictionary of lists". Each list in this dict represents a column in CSV. key of the dict is column label .
- Create a dataframe from this dict
- Save dataframe to CSV
Step 2 :
Documentation : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.from_dict.html
Code Examples : https://pbpython.com/pandas-list-dict.html, https://stackoverflow.com/questions/18837262/convert-python-dict-into-a-dataframe
Step 3 :
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html , https://chrisalbon.com/python/data_wrangling/pandas_saving_dataframe_as_csv/
answered 18 hours ago
Shamit VermaShamit Verma
87929
87929
add a comment |
add a comment |
$begingroup$
I think your JSON example is not valid JSON. Could you provide the valid JSON code?
$endgroup$
– MachineLearner
18 hours ago
1
$begingroup$
It's better to ask this question at stackoverflow.com your question is just a programming problem rather than data science
$endgroup$
– Alireza Zolanvari
18 hours ago