1***@139.com
1***@139.com
  • 发布:2024-11-03 20:54
  • 更新:2024-11-04 08:41
  • 阅读:120

在线求助uni-app x中string转json对象

分类:uni-app x

数据格式为:

{  
    "code": 1,  
    "msg": "查询成功",  
    "time": "1730638328",  
    "data": [  
        {  
            "id": 73,  
            "status": "0",  
            "goods_name": "[\"黄壳20瓦灯泡,省电20瓦日光灯泡\",\"黄壳20瓦灯泡,省电20瓦日光灯泡\"]",  
            "createtime": 1726367788,  
            "order_num": "ORD1726367790955",  
            "user_id": 47,  
            "openid": "olaqO62FAUERo6rNkmUkt3-rsor4",  
            "phone": "13899999999",  
            "order_address": "海南省龙华区",  
            "pay_jiage": 19,  
            "longitude": "86.14365",  
            "latitude": "41.748568",  
            "remarks": "麻烦尽快送一下,着急用呢!谢谢啦",  
            "shanghu_id": 11,  
            "sp_jiage": 10,  
            "peisong_juli": "4.361",  
            "taking_rider_id": null  
        },  
        {  
            "id": 84,  
            "status": "0",  
            "goods_name": "[\"黄壳20瓦灯泡,省电20瓦日光灯泡,黄壳20瓦灯泡,省电20瓦日光灯泡\"]",  
            "createtime": 1726839457,  
            "order_num": "ORD1726839458596",  
            "user_id": 47,  
            "openid": "olaqO62FAUERo6rNkmUkt3-rsor4",  
            "phone": "13579015597",  
            "order_address": "海南省龙华区",  
            "pay_jiage": 14,  
            "longitude": "86.14365",  
            "latitude": "41.748568",  
            "remarks": "麻烦尽快送一下,着急用呢!进大门右拐,然后左拐 然后出去送单。测试",  
            "shanghu_id": 11,  
            "sp_jiage": 5,  
            "peisong_juli": "4.361",  
            "taking_rider_id": null  
        }  
    ]  
}

我想用uni-app x的websocket获取的数据格式是这样的,用typeof读取类型显示string,我想要赋值到一个变量中,然后在view上渲染这个对象数组。在线求助帮写。

2024-11-03 20:54 负责人:无 分享
已邀请:
DCloud_heavensoft
  • 1***@139.com (作者)

    万分感谢大佬回复 我继续研究研究 有了一点思路了

    2024-11-03 22:52

  • 1***@139.com (作者)

    大佬再打扰您下,我还是转换不了了 恳请给个简单的实例 拜托

    2024-11-03 22:57

初晓

初晓

https://doc.dcloud.net.cn/uni-app-x/uts/buildin-object-api/json.html#parseobject-t-text-string

要回复问题请先登录注册