如何从Json路径后处理器中提取值?

时间:2021-08-08 16:05:27

I need to extract id where asOf : 2016-11 for latest run.

我需要在asOf: 2016-11最近一次运行时提取id。

e.g given below response of request I need to store 21aa83fe-fe1b-4447-9b2e-05e7d6cd67d3 in a variable because as of 2016 is in the last and-and the corresponding id is. Could you please tell me how to write JSON Path Post Processor Expression out of it?

e。g在响应以下请求时,我需要将21aa83fe-fe1b-4447-9b2e-05e7d6cd67d3存储在一个变量中,因为截至2016年是最后一个,而相应的id是。请问如何写出JSON路径后处理器表达式?

{"id":"1fabbb02-0b7d-4bec-badd-9fe9f1c63f08","batch" {"id":"GL1600"},"asOf":"2014-06-16T00:00:00Z","version":3,"statusIdentifier":"END"},
{"id":"212fc2b5-03d6-4d76-ab6d-e9e783459120","batch":{"id":"N1400"},"asOf":"2014-06-16T00:00:00Z","version":3,"statusIdentifier":"END"},
{"id":"21aa83fe-fe1b-4447-9b2e-05e7d6cd67d3","batch":{"id":"N1500"},"asOf":"2016-11-16T00:00:00Z","version":3,"statusIdentifier":"END"}, 

1 个解决方案

#1


1  

If your response is valid JSON you can use == filter operator like

如果响应是有效的JSON,可以使用== filter操作符

$..[?(@.asOf == '2016-11-16T00:00:00Z')].id

References:

引用:


If response is not valid JSON you will need to go for Regular Expression Extractor instead.

如果响应不是有效的JSON,则需要使用正则表达式提取器。

#1


1  

If your response is valid JSON you can use == filter operator like

如果响应是有效的JSON,可以使用== filter操作符

$..[?(@.asOf == '2016-11-16T00:00:00Z')].id

References:

引用:


If response is not valid JSON you will need to go for Regular Expression Extractor instead.

如果响应不是有效的JSON,则需要使用正则表达式提取器。