Handle json response data

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
    
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,841评论 18 139
  • JMeter 是一个不错的负载和性能测试工具,我们也用来做 HTTP API 接口测试。我们的 API 返回结果为...
    michael_jia阅读 20,073评论 14 8
  • What is JSON JSON is becoming more and more important as ...
    戈多在地狱阅读 683评论 0 1
  • 已经在这个世界上30多年了,每当回想起来,就感觉恍如隔世,一不小心就有了自己的家庭,还有了儿子,马上又要有...
    漫步_d0d4阅读 188评论 0 0
  • 文/邹海 图/网络 向晚 夜风微凉 时而安静 时而咆哮 时而温柔 时而凶残 世人已无力抗拒 伐木累 只盼在黑夜的尽...
    邹海诗歌阅读 233评论 0 5