0

I am trying to "catch" a value from a json response using regex.

The response:

{"Result":0,"ResponseStatus":{"ErrorCode":null,"Message":null,"StackTrace":null,"Errors":null},"SessionId":"5a004b3b-f610-4a4e-9a0c-9953cee9bd47","ResponseHeader":{"Succeeded":true,"Errors":[]}}

I have created a HTTP request and added a child "JSON PATH EXTRACTOR" with the following data:

Destination Variable Name: SessionId_Regex

JsonPath Expression: "SessionId":"(.{8}-.{4}-.{4}-.{4}-.{12})"

The question is: how do i use the variable of the regex in a 2nd HTTP request

Thanks :)

4
  • Did you want to get the value of SessionId ? why don't your use json parser Commented Mar 14, 2016 at 16:04
  • I also tried it, i dont understand where i put the variable regex name in the 2nd http request Commented Mar 14, 2016 at 16:12
  • Did you want to get the value of SessionId using this (.{8}-.{4}-.{4}-.{4}-.{12}) ? Commented Mar 14, 2016 at 16:30
  • Use a JSON parser instead! If you insist, try this regex: "SessionId":"([^"]+)" Commented Mar 14, 2016 at 18:40

1 Answer 1

1

JSON Path has nothing in common with Regular Expressions, you won't extract the value using above expression.

Change it to: $..SessionId[0]

You can refer extracted value directly as ${SessionId_Regex} or using __V() function like ${__V(SessionId_Regex)} where required

References:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.