Unanswered question

Regular Expression to Extract JSON attribute from Array

Have a Array - Attachments

"Attachments": [
{
"Id": 1001522,
"Name": "18272"
},
{
"Id": 1001300,
"Name": "17751"
}
],

out of the Array, Need a regular expression to Extract "Name" Value as : ["18272","17751"]

Shivani R.
Shivani R.

Shivani R.

Level
0
13 / 100
points

Answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

There are different ways to achieve that. You can either use a single regexp to extract your Names value or you can chain two variables extractor to first extract your attachment block and base your second extractor on that result to extract your values.

For example, see the different screen shots. The two screen shots name regexp1.png and regexp2.png are two ways to extract with a single extraction your values. Then use template 1 or template 2 to use your values.

So if your variable extractor name is "foo" you can call them using those variables: foo_g1 and foo_g2

The second way is to first extract your Attachments block with your Names values. Then create a second variable extractor based on that result.

See screen shot chain1.png and chain2.png.