'How do I link a json file to a search button so that a user can search up the data thru an identifier?

I've been given a JSON file and with it comes a list of over 1000 restaurant information from their names to their location but I don't know how I could link it to a search button where the user can simply try and search the restaurant and it will sort it out for them

`

function readTextFile(file, callback) {
    var rawFile = new XMLHttpRequest();
    rawFile.overrideMimeType("application/json");
    rawFile.open("GET", file, true);
    rawFile.onreadystatechange = function() {
        if (rawFile.readyState === 4 && rawFile.status == "200") {
            callback(rawFile.responseText);
        }
    }
    rawFile.send(null);
}
readTextFile("./walkuprestaurants.json", text => main(JSON.parse(text)))

function main(restaurants) {
  console.log(`${restaurants.length} restaurants loaded.`)
}

`

the JavaScript code above prints out in the console the number of restaurants loaded but now i don't know where to go from here and link it to a button on my website.

When user clicks button, turns into something user can input what they are looking for. they can then press the found result and be taken to a page that displays all information about said restaurant



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source