美文网首页To learn Jmeter
Handle json response data

Handle json response data

作者: 风起帆扬了 | 来源:发表于2018-04-16 22:46 被阅读0次

Json response

{
    "coord":{
        "lon":-76.73,
        "lat":38.94
    },
    "sys":{
        "message":0.0533,
        "country":"US",
        "sunrise":1396694648,
        "sunset":1396740883
    },
    "weather":[
        {
        "id":501,
        "main":"Rain",
        "description":"moderate rain",
        "icon":"10d"
        }
    ],
    "base":"cmc stations",
    "main":{
        "temp":282.25,
        "pressure":1014,
        "humidity":53,
        "temp_min":279.82,
        "temp_max":284.15
    },
    "wind":{
        "speed":7.7,
        "deg":290,
        "gust":13.4
    },
    "rain":{
        "1h":2.29
    },
    "clouds":{
        "all":1
    },
    "dt":1396702471,
    "id":4349159,
    "name":"Bowie",
    "cod":200
}

Regular Expression Extractor vs Json Extractor

正则表达式
Regular Expression Extractor

    "sunrise":(\d+)
    "speed":([\d.]+)
    "weather":(\[.*\])

https://jmeter-plugins.org/wiki/JSONPathExtractor/
http://www.w3schools.com/json/
Json Extractor
    $.sys.sunrise
    $.wind.speed
    $.weather
    $.weather[0]  #first value of list
    

相关文章

网友评论

    本文标题:Handle json response data

    本文链接:https://www.haomeiwen.com/subject/fpeykftx.html