<script>
const jsonStr = `{
"1": {
"1": 1,
"2": 1
},
"2": {
"2": 1
},
"3": {
"1": 1,
"2": 1
},
"4": {
"2": 1,
"3": 1
},
"5": {
"2": 2,
"3": 1
}
}`
console.log(jsonStr,111);
const jsonObj = JSON.parse(jsonStr);
const noIndentJsonStr = JSON.stringify(jsonObj);
console.log(noIndentJsonStr,222); // {"name":"Alice","age":30}
</script>
json那个字符串怎么去掉他的格式 不改变类型,用js怎么写
![](https://img-home.csdnimg.cn/images/20240711042549.png)