数组嵌套对象转换成对象json

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var  arr=[{"money":"100","charge":"1.30","daynum":1},{"money":"200","charge":"2.60","daynum":1}];
        let newObj = {}
        arr.map((item,index) => {
            
        newObj[index] = item
        })
console.log(newObj);

    
    </script>
</body>
</html>

将  
[{"money":"100","charge":"1.30","daynum":1},{"money":"200","charge":"2.60","daynum":1}]
转换成 

猜你喜欢

转载自blog.csdn.net/weixin_44309299/article/details/128499093