小程序里面怎么获取Json数据的长度?
发布于 5 年前 作者 qjiang 8998 次浏览 来自 问答

格式如下。。

{

    “data”: [

        {

            “fldIDI”: “1”,

            “fldSensorNO”: “01”,

            “fldgatherdatetime”: “2017/5/19 8:38:29”,

            “fldGatherDate”: “2017-05-19”,

            “fldGatherTime”: “08:38”,

            “fldTemperature”: “28.4”,

            “fldHumidity”: “65.8”,

            “fldIlluminance”: “598”

        },

        {

            “fldIDI”: “2”,

            “fldSensorNO”: “02”,

            “fldgatherdatetime”: “2017/5/19 8:38:37”,

            “fldGatherDate”: “2017-05-19”,

            “fldGatherTime”: “08:38”,

            “fldTemperature”: “28.4”,

            “fldHumidity”: “65.8”,

            “fldIlluminance”: “324”

        },

        {

            “fldIDI”: “3”,

            “fldSensorNO”: “03”,

            “fldgatherdatetime”: “2017/5/19 8:38:15”,

            “fldGatherDate”: “2017-05-19”,

            “fldGatherTime”: “08:38”,

            “fldTemperature”: “28.4”,

            “fldHumidity”: “65.8”,

            “fldIlluminance”: “1237”

        },

1 回复
wx.request({
      url:'url',
      data:{},
      method:'POST',
      header:{'content-type':'application/x-www-form-urlencoded;charset=UTF-8'},
      success:function(res){
        console.log(res.data.length)
      }
    })
回到顶部