测试接口工具postman

postman当中想用JSON提取器,但是有N个ID的值,请问我怎么提取出来。

img

img

这返回的是一个 json 数组数据, 每个id都是一个 json数组里的 json对象的一个属性
你应该是先取数组,再遍历数组取每个对象里的 id数据

img

var obj = [{"id":"123", "key":"test"}, {"id":"456", "key":"hello"}];

for (var i in obj) 
    console.log(obj[i].id);
  • 你可以参考下这个问题的回答, 看看是否对你有帮助, 链接: https://ask.csdn.net/questions/913901
  • 这篇博客你也可以参考下:Postman发起Post方式JSON格式参数的请求的正确姿势
  • 除此之外, 这篇博客: PostMan 模拟异步请求,json的时间格式问题中的 1.3.2 错误日志 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • 21:26:24.991 [http-nio-8080-exec-7] WARN  org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type `java.util.Date` from String "2020-12-12 12:02:56": not a valid representation (error: Failed to parse Date value '2020-12-12 12:02:56': Cannot parse date "2020-12-12 12:02:56": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSX', parsing fails (leniency? null)); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.util.Date` from String "2020-12-12 12:02:56": not a valid representation (error: Failed to parse Date value '2020-12-12 12:02:56': Cannot parse date "2020-12-12 12:02:56": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSX', parsing fails (leniency? null))
     at [Source: (PushbackInputStream); line: 10, column: 13] (through reference chain: com.springboot.template.springbootwebrestfulcrud.entity.Employee["birth"])]
    

  • 您还可以看一下 张颜源老师的21年新接口自动化测试视频postman教程 零基础接口测试课程中的 企业开发主流轻量级的数据交换格式json讲解小节, 巩固相关知识点