如何使用JavaScript

时间:2018-09-02 16:25:34

标签: javascript

在这里,我有以下json数据:

{
    "data": [
        {
            "info": 21,
            "datatype": "string",
            "uid": "00:00:00:02",
            "mainData": {
                "person": "admin",
                "values": [
                    "192.168.0.5",
                    "192.168.0.6"
                ],
                "variable": "maximum",
                "device": "samsung_device"
            },
            "operator": "admin"
        },
        {
            "info": 2,
            "datatype": "string",
            "uid": "00:00:00:05",
            "mainData": {
                "person": "admin",
                "values": [
                    "192.168.0.5",
                    "192.168.0.6"
                ],
                "variable": "maximum",
                "device": ""
            },
            "operator": "admin"
        },   {
            "info": 2,
            "datatype": "string",
            "uid": "00:00:00:05",
            "mainData": {
                "person": "admin",
                "values": [
                    "192.168.0.5",
                    "192.168.0.6"
                ],
                "variable": "maximum",
                "device": ""
            },
            "operator": "admin"
        },
    ]
}

我想要实现的是
1.只有首先,我想检索第一个索引的uid值并想在按钮中显示该值,然后单击第一个索引的uid,然后必须显示mainData属性和值

mainData": {
                    "person": "admin",
                    "values": [
                        "192.168.0.5",
                        "192.168.0.6"
                    ]

我在这里尝试过data.['uid'].['maindata].[values],但不是马上结束

0 个答案:

没有答案