I'm trying to read a dataset and set the integer value of the JSON file as the array of the list. This is the example JSON file,
[{
"index_id": "1234",
"text": "hello world",
},
{
"index_id": "5678",
"text": "roses are red",
}]
Right now, I have just tried with reading the JSON file and putting everything to a defaultdict(list), this messes things up. Assume I read everything to L1
If I try to get L1[1234] this would give an error as 1234 is not a valid index in the L1 and the indexes are 0,1.
If L1 was printed,
{u'1234': u'hello world'}, {u'5678': u'roses are red'}]
I understand that the list has my potential value for the index as a value stored and in unicode (makes it worse).
So how to turn L1 into or a method so if I try to pull up L1[1234] it would pull up the 'hello world',
{1234: u'hello world'}, {5678: u'roses are red'}]
Thank you
Edited: Changed the JSON.
json. this is list of two differentdicts/json