I am importing a jsonl file from my hard drive and trying to get it into a usable format. Here is how I'm importing the data.
train_data=[]
with open("Documents/data/train.jsonl",'r',encoding='utf-8') as j:
for line in j:
train_data.append(json.loads(line))
Which produces data structured like this.
train_data[1]
Out[59]:
{'id': 46971,
'img': 'img/46971.png',
'label': 1,
'text': 'text'}
Basically I would like to convert this data to a dictionary format where the dictionary value is the "id" and the rest of the data is associated with that dictionary label. I believe something like the following, but I'm pretty new to Python so I may be displaying this incorrectly.
print(dict_ex)
{46971: ['img/46971.png', 1, 'text']}