Best way to extract value from Json array Object and assign if we know the max value of array incoming.

I am having a problem to extract the variable from Json Object which is of data type 'array'. What could be the best way to extract these array objects from request and assign it to send the values to target API.

Solved Solved
0 3 3,314
1 ACCEPTED SOLUTION

sidd-harth
Participant V

Vamshi, if you want to extract only one or few known variables from JSON, you can go ahead with Extract Variable Policy or Assign Message Policy(with message template).

Can you provide a sample JSON Object to give you a possible solution?

View solution in original post

3 REPLIES 3

sidd-harth
Participant V

Vamshi, if you want to extract only one or few known variables from JSON, you can go ahead with Extract Variable Policy or Assign Message Policy(with message template).

Can you provide a sample JSON Object to give you a possible solution?

hey, thanks for suggesting. Yes for now am considering that option and wanted to know if their is any different and best approach. Below is the array and we can expect 1 or 3 contacts.

"contact":[{"contactType":"HOME","contactNumber":"string"}],

current implementation in extractvariables policy:

<Variable name="contactDetails"> <JSONPath>$.applicantInfo.contact[*]</JSONPath> </Variable>

In Assign message, am assigning it as below.

"contact": {contactDetails},

sidd-harth
Participant V

Vamshi, if you want to extract only one or few known variables from JSON, you can go ahead with Extract Variable Policy or Assign Message Policy(with message template).

Can you provide a sample JSON Object to give you a possible solution?