鉴于我有以下"名称"和"价值"字符串:
<input type="text" name="attributes[options][0][label]" value="Test Option">
<input type="text" name="attributes[options][0][value]" value="test-option">
<input type="text" name="attributes[options][1][label]" value="Another Test Option">
<input type="text" name="attributes[options][1][value]" value="another-test-option">
如何转换为以下JSON格式?
attributes: {
options: [
{
label: "Test Option",
value: "test-option",
},
{
label: "Another Test Option",
value: "another-test-option",
},
],
}