1. 将csv里面的文字复制粘贴到
网址:https://www.bejson.com/json/col2json/
结果如下:
id name
Free Size Free Size
XXS XXS
XS XS
S S
M M
L L
XL XL
XXL XXL
XXXL XXXL
XXXXL XXXXL
Special Body Special Body
-------------------------> 转成:
[
{"id":"Free Size","name":"Free Size"},
{"id":"XXS","name":"XXS"},
{"id":"XS","name":"XS"},
{"id":"S","name":"S"},
{"id":"M","name":"M"},
{"id":"L","name":"L"},
{"id":"XL","name":"XL"},
{"id":"XXL","name":"XXL"},
{"id":"XXXL","name":"XXXL"},
{"id":"XXXXL","name":"XXXXL"},
{"id":"Special Body","name":"Special Body"},
]
2. 转化后,进行校验
网址:https://www.bejson.com/
一般校验会出现问题:因为后面多个逗号
结果如下:
[{
"id": "Free Size",
"name": "Free Size"
},
{
"id": "XXS",
"name": "XXS"
},
{
"id": "XS",
"name": "XS"
},
{
"id": "S",
"name": "S"
},
{
"id": "M",
"name": "M"
},
{
"id": "L",
"name": "L"
},
{
"id": "XL",
"name": "XL"
},
{
"id": "XXL",
"name": "XXL"
},
{
"id": "XXXL",
"name": "XXXL"
},
{
"id": "XXXXL",
"name": "XXXXL"
},
{
"id": "Special Body",
"name": "Special Body"
} --------------------------------------这里无逗号
]
3. 对json进行压缩
网址:https://www.bejson.com/zhuanyi/
结果如下:
[{"id":"Free Size","name":"Free Size"},{"id":"XXS","name":"XXS"},{"id":"XS","name":"XS"},{"id":"S","name":"S"},{"id":"M","name":"M"},{"id":"L","name":"L"},{"id":"XL","name":"XL"},{"id":"XXL","name":"XXL"},{"id":"XXXL","name":"XXXL"},{"id":"XXXXL","name":"XXXXL"},{"id":"Special Body","name":"Special Body"}]