I am trying to create a JMeter script for an online insurance application that creates repair bookings for automotive claims. One of the responses to this application returns a JSON object that has the time slots available and unavailable to book repair jobs. An example of the JSON is below.
{
"7": {
"45": 1,
"30": 1
},
"8": {
"45": 1,
"30": 0,
"15": 1,
"00": 0
},
"9": {
"45": 1,
"30": 1,
"15": 1,
"00": 1
},
"10": {
"45": 0,
"30": 1,
"15": 1,
"00": 1
}
}
This shows the hours 7am, 8am, 9am and 10am. With timeslots 7:45, 7:30, 7:00 etc. A 1 against the minute slot indicates that this slot is free. So the first free slot is 7:45.
How can I use a regular expression to extract the first free slot?
I came up with this regex to get the hour slot... "(\d{1})":{"\d{2}":1
, but can't work out how to accurately extract the minute slot.
I'm wondering whether it would be easier to do this using a BSF Postprocessor and some javascript. Unfortunately my scripting skills are poor.
Can anyone offer me any help in how to extract this info using a regex or possibly using a BSF post processor?