I get the following response from server in JSON:
{
"global_id": 00001,
"name": "IMG_0747.JPG",
"time_taken": {
"segment_1_time": 1,
"segment_2_time": 1,
"segment_3_time": 27,
"segment_4_time": 1,
"segment_5_time": 16,
"segment_6_time": 20,
}
}
I want to extract the values of segment_1_time, segment_2_time,....,segment_6_time. To do so, I am using the following values in Regular Expression Extractor (for segment 1 only):
Reference Name: s1time
Regular Expression: "segment_1_time": (\d+)
Template: $1$
Match No: 1
Default Value: 0
I wrote this script in Bean Shell Post Processor to get value of segment_1_time in order to use it for further processing:
String time_s1= vars.get("s1time");
log.info("Segment 1 time= "+time_s1);
For some reason, I always get NULL in time_s1. I also tried using var time_s1 instead of String time_s1 but it gives null value too. Where am I going wrong?