JSON数值元素顺序

用于判断使用Jsonpath语法获取到的用例返回值中数组某元素排序是升序或降序排列。


表示使用Jsonpath语法对数组中某元素顺序进行校验,升序=ascending 降序=descending。如参数列输入$.priceRegionList[*].upperPrice,值列输入ascending。则判断upperPrice值是否是升序排列。

如校验返回值中upperPrice为升序排列,响应body为:

BODY
"{...}":
"code":200,
"msg":"OK",
"priceRegionList":[
  {
  "lowerPrice":0.0,
  "ration":0.0,
  "upperPrice":49.0,
  "multiChoose":true,
  "class":"com.netease.haitao.search.planner.base.api.entity.PriceRegion"
  },
{
  "lowerPrice":50.0,
  "ration":0.0,
  "upperPrice":79.0,
  "multiChoose":true,
  "class":"com.netease.haitao.search.planner.base.api.entity.PriceRegion"
},
{
  "lowerPrice":80.0,
  "ration":0.0,
  "upperPrice":199.0,
  "multiChoose":true,
  "class":"com.netease.haitao.search.planner.base.api.entity.PriceRegion"
},
...
Copyright © GoApi 2018 all right reserved,powered by Gitbook该文件修订时间: 2023-08-24 14:35:00

results matching ""

    No results matching ""