如何为JSON执行正则表达式或JSON XPATH表达式

时间:2017-08-25 00:55:35

标签: json xpath jmeter

有些人可以告诉我如何为JSON做正则表达式或JSON XPATH表达式" GLDefaultId"和" GLDefaultValueId":以下请求POST数据中的1

请求: 发布数据: {" GLDefaultId":0,"专案编号":1806," CoaMainId":10,"用户ID":33,"备注& #34;:""" PRO_GLDefaultValue":[{" GLDefaultValueId":0," GLDefaultId":0," SegmentId":16,"别名":" ACT"" SegmentType":" DETAIL"" FunctionTypeId&#34 ;:0,"值":"&安培;&安培;&安培;""面膜":"&安培;&安培;&安培;&#34 ;," IsRequired":真,"上次更改时间":空," IsCoaRequired":真},{" GLDefaultValueId":0,&# 34; GLDefaultId":0," SegmentId":17,"别名":" ST"" SegmentType":&#34 ; SET"" FunctionTypeId":0,"值":"&安培;&安培;""面膜":&# 34;&安培;&安培;"" IsRequired":假,"上次更改时间":空," IsCoaRequired":假}]}

响应: {" $ ID":" 1"" GLDefaultId":1,"专案编号":1806," CoaMainId" :10,"注释":""" PRO_GLDefaultValue":[{" $ ID":" 2" " GLDefaultValueId":1," GLDefaultId":1,"别名":" ACT"" FunctionTypeId&#34 ;: 0,"值":"&安培;&安培;&安培;"" SegmentId":16," IsRequired":真,&# 34; ModifiedOn":" 2017-08-11T17:27:26.562989-07:00"" ModifiedBy":33," PRO_GLDefault":{& #34; $ REF":" 1"}"上次更改时间":空},{" $ ID":" 3" " GLDefaultValueId":2" GLDefaultId":1,"别名":" ST"" FunctionTypeId&#34 ;: 0,"值":"&安培;&安培;"" SegmentId":17," IsRequired":假," ModifiedOn":" 2017-08-11T17:27:26.562989-07:00"" ModifiedBy":33," PRO_GLDefault" {&#34 ; $ REF":" 1"}"上次更改时间":空}]}

1 个答案:

答案 0 :(得分:0)

您可以使用$.*[*].GLDefaultId$.*[*].GLDefaultValueId作为JSON路径来提取值。