How to find multiple occurrence of a word in a string if the number of occurrences of the word is not known

General

How to find multiple occurrence of a word in a string if the number of occurrences of the word is not known

Hi All

I have a string as below

selectedProductList={"reservedProduct":[{"specialInstruction":"Enjoy the pet","unitPrice":135,"selectedOptions":[{"optionName":"color","optionValue":"black"},{"optionName":"size","optionValue":"adult"},{"optionName":"Weeks","optionValue":"one"}}

I need to get the values after optionName and optionValue

i.e for {"optionName":"color","optionValue":"black"} - I need to show color and black in my report.

But the number of occurrences of optionName and optionValue words are not known

1 REPLY
Enthusiast

Re: How to find multiple occurrence of a word in a string if the number of occurrences of the word is not known

Recursive can be useful.