所以基本上有这样的结构:
{
"i$tems": {
"it$em": [
{
"batt$ers": {
"ba$tter": [
{
"i$d": "1001",
"t$ype": "Regular"
},
{
"i$d": "1002",
"type": "Chocolate"
},
{
"i$d": "1003",
"t$ype": "Blueberry"
},
{
"i$d": "1004",
"t$ype": "Devil's Food"
}
]
},
"$id": "0001",
"$name": "Cake",
"$ppu": 0.55,
"$topping": [
{
"i$d": "5001",
"t$ype": "None"
},
{
"i$d": "5002",
"t$ype": "Glazed"
},
{
"i$d": "5005",
"t$ype": "Sugar"
},
{
"i$d": "5007",
"t$ype": "Powdered Sugar"
},
{
"i$d": "5006",
"t$ype": "Chocolate with Sprinkles"
},
{
"i$d": "5003",
"t$ype": "Chocolate"
},
{
"i$d": "5004",
"t$ype": "Maple"
}
],
"ty$pe": "donut"
}
]
}
}
并想要这样的东西:
{
"items": {
"item": [
{
"batters": {
"batter": [
{
"id": "1001",
"type": "Regular"
},
{
"id": "1002",
"type": "Chocolate"
},
{
"id": "1003",
"type": "Blueberry"
},
{
"id": "1004",
"type": "Devil's Food"
}
]
},
"id": "0001",
"name": "Cake",
"ppu": 0.55,
"topping": [
{
"id": "5001",
"type": "None"
},
{
"id": "5002",
"type": "Glazed"
},
{
"id": "5005",
"type": "Sugar"
},
{
"id": "5007",
"type": "Powdered Sugar"
},
{
"id": "5006",
"type": "Chocolate with Sprinkles"
},
{
"id": "5003",
"type": "Chocolate"
},
{
"id": "5004",
"type": "Maple"
}
],
"type": "donut"
}
]
}
}
在红宝石