Is there a way to create a function that can scan through a JSON file and identify the index where a specific key-value pair is located within an object? For instance, if we were searching for value: '100.0'
in the following JSON data, the function should return 0
because the object with key1
is at index 0
.
var object = {
key1 : {
name : 'xxxxxx',
value : '100.0'
},
key2 : {
name : 'yyyyyyy',
value : '200.0'
},
key3 : {
name : 'zzzzzz',
value : '500.0'
},
}