有这样一个json,其中3个label全部为“t”,我需要将label依次替换成“1”,“2”,“3” 请问我如何将数字依次更改到label中?
↓原json:
{
"version": "4.5.10",
"flags": {},
"shapes": [
{
"label": "t",
"points": [
[
2132.5,
648.0
]
],
"group_id": null,
"shape_type": "point",
"flags": {}
},
{
"label": "t",
"points": [
[
2135.0,
748.0
]
],
"group_id": null,
"shape_type": "point",
"flags": {}
},
{
"label": "t",
"points": [
[
2130.0,
850.5
]
],
"group_id": null,
"shape_type": "point",
"flags": {}
}
],
"imagePath": "1653041701.jpg",
"imageData": null,
"imageHeight": 2160,
"imageWidth": 3840
}
↓希望替换成的json:
{
"version": "4.5.10",
"flags": {},
"shapes": [
{
"label": "1",
"points": [
[
2132.5,
648.0
]
],
"group_id": null,
"shape_type": "point",
"flags": {}
},
{
"label": "2",
"points": [
[
2135.0,
748.0
]
],
"group_id": null,
"shape_type": "point",
"flags": {}
},
{
"label": "3",
"points": [
[
2130.0,
850.5
]
],
"group_id": null,
"shape_type": "point",
"flags": {}
}
],
"imagePath": "1653041701.jpg",
"imageData": null,
"imageHeight": 2160,
"imageWidth": 3840
}