Let's say I have two lists
a= ['apple', 'orange', 'banana']
b= ['red', 'orange', 'yellow']
How can I convert it to a JSON object, using a second list as a guide for the attribute names?
For example, I would define attributes = ['fruit', 'color']
in order to get
result = [
{fruit: 'apple', color: 'red'},
{fruit: 'orange', color: 'orange'},
{fruit: 'banana', color: 'yellow'}]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…