Skip to content
Advertisement

How to select the complete JSON node if any key-value pair matched inside the node?

I have JSON some thing like below

JavaScript

I am aware how to iterate through JSON Array based on key and extract the values of that particular key. But stuck with one scenario let say instead of key i have value with if i have value ‘s1’ with me i want to traverse through above JSON and if it matches with any value i want to extract the complete JSON related to that value ‘s1’ like below

JavaScript

Please suggest some idea how can i do this i am newbie to JSON. Thanks in advance.

Advertisement

Answer

JavaScript

you can use this function by sending array of sellers from your JSON

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement