【发布时间】:2014-06-04 21:26:50
【问题描述】:
CSV
id,modifier1_name,modifier2_price,modifier2_name,modifier2_price,modifier2_status
1,'Small',10,'Large',20,'YYY'
2,'Small',20,'Large',30,'YYY'
JSON
[
{
id: 1,
modifier: [
{name: 'Small', price: 10},
{name: 'Large', price: 20, status: 'YYY'}]
},
{
id: 2,
modifier: [
{name: 'Small', price: 20},
{name: 'Large', price: 30, status: 'YYY'}],
}
]
当修饰符可以不同时,如何将 CSV 转换为 Json?
【问题讨论】:
-
在
JSON对象中不能有相同的键modifier出现多次