cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy - validate Json array

SOLVED
Contributor

Groovy - validate Json array

Json: "prodS": {"langTrans": [{ "Id": "11", lang="EN"}, {"Id": "11", lang="FR"},{ "Id": "12", lang="EN"}, {"Id": "12", lang="FR"}], "rates":[{"Id":"11","rate": 100},{Id":"12","rate":200}] }
Here we have 2 arrays. one is ProdS and other is rates.
I have to validate for each Id under rates array, I should find one lang 'EN' & lang'Fr' for that matching Id under langTrans array.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Groovy - validate Json array

4 REPLIES 4
Highlighted
Community Hero

Re: Groovy - validate Json array

Hi,

 

I might be able to help but I don't completely understand your problem. Could you please elaborate more?



If my answer helped please click on the 'Accept as Solution' button.
Highlighted
Contributor

Re: Groovy - validate Json array

@Lucian, for each Id(Id=11,...) under rates array, I should find a lang = 'EN' & 'FR' for that matching Id(Id=11,....) under langTrans array, if lang EN & FR Not found then I should fail, as no lang found(EN&FR) for the Id.

Highlighted
Community Hero

Re: Groovy - validate Json array

Highlighted
Contributor

Re: Groovy - validate Json array

Thank you @nmrao