testing
by brigand
HTML
<script>
// I looked here for inspiration:
// https://stackoverflow.com/questions/7364150/find-object-by-id-in-an-array-of-javascript-objects
// this is normally a JSON file I read from the disk
var data = '{"language.name": "English","language.region": "United States", "language.code": "en_us"}';
// to my knowledge I need to convert to array to use filter
// I only need the string of the result so that's fine with me.
var dataJson = JSON.parse(data);
var entries = Object.entries(dataJson);
// I want to find the result "language.name", so I search for "English"
var searchVal = "English";
// this is likely where it goes wrong?
const match = entries.find(entry => entry[1] === searchVal);
console.log("Find: " + (match && match[0]));
console.log("Filter: " + (match && match[1]));
</script>