我将以下xml转换为json
<?xml version="1.0" encoding="UTF-8" ?>
<category>
<sports id="100">
<indoor id="1000">
<basketball id="100k" />
<pool id="200k" />
</indoor>
<outdoor id="2000">
<hockey id="300k" />
<baseball id="400k" />
</outdoor>
</sports>
<electric id="200">
<entertainment id="3000">
<tv id="500k" />
<hifi id="600k" />
</entertainment>
<kitchen id="4000">
<kettles id="700k" />
</kitchen>
</electric>
</category>
当我这样做时,json在键上显示减号&#34; id&#34;当它被分配了一个数字
{
"category": {
"sports": {
"-id": "100",
"indoor": {
"-id": "1000",
"basketball": { "-id": "100k" },
"pool": { "-id": "200k" }
},
"outdoor": {
"-id": "2000",
"hockey": { "-id": "300k" },
"baseball": { "-id": "400k" }
}
},
"electric": {
"-id": "200",
"entertainment": {
"-id": "3000",
"tv": { "-id": "500k" },
"hifi": { "-id": "600k" }
},
"kitchen": {
"-id": "4000",
"kettles": { "-id": "700k" }
}
}
}
}
为什么它会显示一个数字?这是正常的还是应该修改&#34; id&#34;财产没有减号?
答案 0 :(得分:0)
该转换器使用' - '作为属性前缀。请改用此选项,您可以在其中为这些前缀选择所需的字符:http://www.freeformatter.com/xml-to-json-converter.html