2
votes

I have got a simple ajax response and I am trying to extract the value of orderId and orderItemId from the below response. I tried json path post processor as well as regular expression extractor.

I gave like this in the post processor

"orderId": ["(.+?)"] template-$1$ Match No-1, in the Regular Expression. But it is not extracting the value.

/*
{"orderId": ["1389104"],"orderItemId": ["7900094"],
}
*/

Any idea why? I have extracted more complicated values using regex. This one is a bit strange.Is there any difference if it is an ajax response?

2
Did you checked the answers?user7294900

2 Answers

1
votes

Use this Regular Expression: "orderId": \["(.+?)"]

1
votes

You were close, but [ is a special character is regex, you need to escape it with \, use Regular Expression Extractor

Regular Expression: orderId": \["(\d+)

Template $1$ 

Match No 1