I'm not able to convert two list to json format.
i have tried to convert two list to dictionary format and then converted to json format but duplicate key arenot there which i want too.
p = np.argmax(y[:416], axis=-1)
# print(p)
flat_list_te = padd_to_2d_senti[:416]
flat_list_test = [item for sublist in flat_list_te for item in sublist]
# print(flat_list_test)
# flat_list = [item for sublist in y_te[i] for item in sublist]
flat_list_pred = [item for sublist in p for item in sublist]
key = []
value = []
for w,pred in zip(flat_list_test,flat_list_pred):
predicted_tag = idx2tag[pred]
if predicted_tag !='O':
a.append(w)
b.append(idx2tag[pred])
test_pred = dict(zip(key,value))
expected output:
key = ["phone","age","class","class"]
value = [123,4,5,6]
dic = {"phone":123,"age":4,"class":5,"class":6}