微信小程序将数组[{"name":"ç¥çµè¿","permission":1,"id":1,"username":"2022117080","exp":1701798957}]转化为json格式并获取它的id
时间: 2023-12-11 09:05:18 浏览: 91
6-纹理映射1
以下是将数组转化为JSON格式并获取id的代码示例:
```javascript
var arr = [{"name":"祁灵运","permission":1,"id":1,"username":"2022117080","exp":1701798957}];
var jsonStr = JSON.stringify(arr); // 将数组转化为JSON格式的字符串
var jsonObj = JSON.parse(jsonStr); // 将JSON格式的字符串转化为JSON对象
var id = jsonObj[0].id; // 获取id
console.log(id); // 输出:1
```
阅读全文